diff --git a/pom.xml b/pom.xml
index 6f585248..0f2c0356 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,6 +132,12 @@
compile
+
+ javax.inject
+ javax.inject
+ 1
+ provided
+
org.slf4j
slf4j-api
@@ -156,9 +162,8 @@
- junit
- junit
- 4.13.2
+ org.junit.jupiter
+ junit-jupiter-api
test
@@ -167,13 +172,6 @@
3.5.1
test
-
-
- org.apache.maven
- maven-compat
- ${mavenVersion}
- test
-
org.mockito
mockito-core
@@ -186,12 +184,6 @@
${slf4jVersion}
test
-
- org.apache.maven.resolver
- maven-resolver-impl
- ${resolverVersion}
- test
-
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
index 3ec2fe3b..52a048a6 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
@@ -18,341 +18,195 @@
*/
package org.apache.maven.plugins.install;
+import javax.inject.Inject;
+
import java.io.File;
import java.io.Reader;
-
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoExtension;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.project.DefaultProjectBuildingRequest;
-import org.apache.maven.project.ProjectBuildingRequest;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.XmlStreamReader;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.impl.DefaultLocalPathComposer;
-import org.eclipse.aether.internal.impl.DefaultLocalPathPrefixComposerFactory;
-import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
-import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Allan Ramirez
*/
-public class InstallFileMojoTest extends AbstractMojoTestCase {
- private String groupId;
-
- private String artifactId;
-
- private String version;
-
- private String packaging;
-
- private String classifier;
+@MojoTest(realRepositorySession = true)
+@Basedir("/unit/install-file-test")
+@MojoParameter(name = "groupId", value = "org.apache.maven.test")
+@MojoParameter(name = "artifactId", value = "maven-install-file-test")
+@MojoParameter(name = "version", value = "1.0-SNAPSHOT")
+public class InstallFileMojoTest {
- private File file;
+ @TempDir
+ private Path tempDir;
- private static final String LOCAL_REPO = "target/local-repo/";
+ private File localRepo;
+ private File specificLocalRepositoryPath;
- private static final String SPECIFIC_LOCAL_REPO = "target/specific-local-repo/";
+ @Inject
+ private MavenSession mavenSession;
+ @BeforeEach
public void setUp() throws Exception {
- super.setUp();
-
- FileUtils.deleteDirectory(new File(getBasedir() + "/" + LOCAL_REPO));
- FileUtils.deleteDirectory(new File(getBasedir() + "/" + SPECIFIC_LOCAL_REPO));
- }
-
- public void testInstallFileFromLocalRepositoryToLocalRepositoryPath() throws Exception {
- File localRepository =
- new File(getBasedir(), "target/test-classes/unit/install-file-from-local-repository-test/target");
-
- File testPom = new File(localRepository.getParentFile(), "plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(localRepository.getAbsolutePath()));
-
- File specificLocalRepositoryPath = new File(getBasedir() + "/" + SPECIFIC_LOCAL_REPO);
-
- setVariableValueToObject(mojo, "localRepositoryPath", specificLocalRepositoryPath);
-
- assignValuesForParameter(mojo);
-
- mojo.execute();
-
- String localPath = getBasedir() + "/" + SPECIFIC_LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/"
- + artifactId + "-" + version;
-
- File installedArtifact = new File(localPath + "." + "jar");
-
- assertTrue(installedArtifact.exists());
-
- assertEquals(
- FileUtils.getFiles(new File(SPECIFIC_LOCAL_REPO), null, null).toString(),
- 5,
- FileUtils.getFiles(new File(SPECIFIC_LOCAL_REPO), null, null).size());
+ localRepo = tempDir.resolve("local-repo").toAbsolutePath().toFile();
+ mavenSession.getRequest().setLocalRepositoryPath(localRepo);
+
+ specificLocalRepositoryPath =
+ tempDir.resolve("specific-local-repo").toAbsolutePath().toFile();
+ mavenSession
+ .getUserProperties()
+ .setProperty("specificLocalRepositoryPath", specificLocalRepositoryPath.getAbsolutePath());
}
- public void testInstallFileWithLocalRepositoryPath() throws Exception {
- File testPom =
- new File(getBasedir(), "target/test-classes/unit/install-file-with-checksum/" + "plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- File specificLocalRepositoryPath = new File(getBasedir() + "/" + SPECIFIC_LOCAL_REPO);
-
- setVariableValueToObject(mojo, "localRepositoryPath", specificLocalRepositoryPath);
-
- assignValuesForParameter(mojo);
-
+ @Test
+ @InjectMojo(goal = "install-file")
+ @MojoParameter(name = "packaging", value = "jar")
+ @MojoParameter(name = "file", value = "${basedir}/target/maven-install-test-1.0-SNAPSHOT.jar")
+ @MojoParameter(name = "localRepositoryPath", value = "${specificLocalRepositoryPath}")
+ public void testInstallFileWithLocalRepositoryPath(InstallFileMojo mojo) throws Exception {
mojo.execute();
- String localPath = getBasedir() + "/" + SPECIFIC_LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/"
- + artifactId + "-" + version;
-
- File installedArtifact = new File(localPath + "." + "jar");
+ File installedArtifact = new File(
+ specificLocalRepositoryPath,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.jar");
- assertTrue(installedArtifact.exists());
+ assertTrue(
+ installedArtifact.exists(), "Installed artifact should exist: " + installedArtifact.getAbsolutePath());
assertEquals(
- FileUtils.getFiles(new File(SPECIFIC_LOCAL_REPO), null, null).toString(),
- 5,
- FileUtils.getFiles(new File(SPECIFIC_LOCAL_REPO), null, null).size());
- }
-
- public void testInstallFileTestEnvironment() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/install-file-basic-test/plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assertNotNull(mojo);
+ 5, FileUtils.getFiles(specificLocalRepositoryPath, null, null).size());
}
- public void testBasicInstallFile() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/install-file-basic-test/plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assignValuesForParameter(mojo);
-
+ @Test
+ @InjectMojo(goal = "install-file")
+ @MojoParameter(name = "packaging", value = "jar")
+ @MojoParameter(name = "file", value = "${basedir}/target/maven-install-test-1.0-SNAPSHOT.jar")
+ void testBasicInstallFile(InstallFileMojo mojo) throws Exception {
mojo.execute();
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "."
- + packaging);
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.jar");
- assertTrue(installedArtifact.exists());
+ assertTrue(
+ installedArtifact.exists(), "Installed artifact should exist: " + installedArtifact.getAbsolutePath());
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(5, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testInstallFileWithClassifier() throws Exception {
- File testPom =
- new File(getBasedir(), "target/test-classes/unit/install-file-with-classifier/plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assignValuesForParameter(mojo);
-
- assertNotNull(classifier);
-
+ @Test
+ @InjectMojo(goal = "install-file")
+ @MojoParameter(name = "packaging", value = "jar")
+ @MojoParameter(name = "classifier", value = "sources")
+ @MojoParameter(name = "file", value = "${basedir}/target/maven-install-test-1.0-SNAPSHOT.jar")
+ void testInstallFileWithClassifier(InstallFileMojo mojo) throws Exception {
mojo.execute();
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "-"
- + classifier + "." + packaging);
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT-sources.jar");
- assertTrue(installedArtifact.exists());
+ assertTrue(
+ installedArtifact.exists(), "Installed artifact should exist: " + installedArtifact.getAbsolutePath());
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(5, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testInstallFileWithGeneratePom() throws Exception {
- File testPom =
- new File(getBasedir(), "target/test-classes/unit/install-file-test-generatePom/plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assignValuesForParameter(mojo);
-
+ @Test
+ @InjectMojo(goal = "install-file")
+ @MojoParameter(name = "packaging", value = "jar")
+ @MojoParameter(name = "generatePom", value = "true")
+ @MojoParameter(name = "file", value = "${basedir}/target/maven-install-test-1.0-SNAPSHOT.jar")
+ void testInstallFileWithGeneratePom(InstallFileMojo mojo) throws Exception {
mojo.execute();
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "."
- + packaging);
-
- assertTrue((Boolean) getVariableValueFromObject(mojo, "generatePom"));
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.jar");
- assertTrue(installedArtifact.exists());
+ assertTrue(
+ installedArtifact.exists(), "Installed artifact should exist: " + installedArtifact.getAbsolutePath());
File installedPom = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "."
- + "pom");
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.pom");
try (Reader reader = new XmlStreamReader(installedPom)) {
Model model = new MavenXpp3Reader().read(reader);
assertEquals("4.0.0", model.getModelVersion());
-
- assertEquals((String) getVariableValueFromObject(mojo, "groupId"), model.getGroupId());
-
- assertEquals(artifactId, model.getArtifactId());
-
- assertEquals(version, model.getVersion());
+ assertEquals("org.apache.maven.test", model.getGroupId());
+ assertEquals("maven-install-file-test", model.getArtifactId());
+ assertEquals("1.0-SNAPSHOT", model.getVersion());
}
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(5, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testInstallFileWithPomFile() throws Exception {
- File testPom =
- new File(getBasedir(), "target/test-classes/unit/install-file-with-pomFile-test/plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assignValuesForParameter(mojo);
-
+ @Test
+ @InjectMojo(goal = "install-file")
+ @MojoParameter(name = "packaging", value = "jar")
+ @MojoParameter(name = "file", value = "${basedir}/target/maven-install-test-1.0-SNAPSHOT.jar")
+ @MojoParameter(name = "pomFile", value = "${basedir}/plugin-config.xml")
+ void testInstallFileWithPomFile(InstallFileMojo mojo) throws Exception {
mojo.execute();
- File pomFile = (File) getVariableValueFromObject(mojo, "pomFile");
-
- assertTrue(pomFile.exists());
-
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "."
- + packaging);
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.jar");
- assertTrue(installedArtifact.exists());
+ assertTrue(
+ installedArtifact.exists(), "Installed artifact should exist: " + installedArtifact.getAbsolutePath());
File installedPom = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "."
- + "pom");
-
- assertTrue(installedPom.exists());
-
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
- }
-
- public void testInstallFileWithPomAsPackaging() throws Exception {
- File testPom = new File(
- getBasedir(), "target/test-classes/unit/install-file-with-pom-as-packaging/" + "plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assignValuesForParameter(mojo);
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.pom");
- assertTrue(file.exists());
+ assertTrue(installedPom.exists(), "Installed pom should exist: " + installedPom.getAbsolutePath());
- assertEquals("pom", packaging);
-
- mojo.execute();
-
- File installedPom = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "."
- + "pom");
-
- assertTrue(installedPom.exists());
+ // Compare the contents of the installed pom with the original pom file
+ assertEquals(
+ Files.readAllLines(
+ MojoExtension.getTestFile("plugin-config.xml").toPath()),
+ Files.readAllLines(installedPom.toPath()));
- assertEquals(4, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(5, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testInstallFile() throws Exception {
- File testPom =
- new File(getBasedir(), "target/test-classes/unit/install-file-with-checksum/" + "plugin-config.xml");
-
- InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
-
- assertNotNull(mojo);
-
- setVariableValueToObject(mojo, "session", createMavenSession(LOCAL_REPO));
-
- assignValuesForParameter(mojo);
-
+ @Test
+ @InjectMojo(goal = "install-file")
+ @MojoParameter(name = "packaging", value = "pom")
+ @MojoParameter(name = "file", value = "${basedir}/plugin-config.xml")
+ void testInstallFileWithPomAsPackaging(InstallFileMojo mojo) throws Exception {
mojo.execute();
- String localPath = getBasedir() + "/" + LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/"
- + artifactId + "-" + version;
-
- File installedArtifact = new File(localPath + "." + "jar");
+ File installedPom = new File(
+ localRepo,
+ "org/apache/maven/test/maven-install-file-test/1.0-SNAPSHOT/maven-install-file-test-1.0-SNAPSHOT.pom");
- assertTrue(installedArtifact.exists());
+ assertTrue(installedPom.exists(), "Installed pom should exist: " + installedPom.getAbsolutePath());
+ // Compare the contents of the installed pom with the original pom file
assertEquals(
- FileUtils.getFiles(new File(LOCAL_REPO), null, null).toString(),
- 5,
- FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
- }
-
- private void assignValuesForParameter(Object obj) throws Exception {
- this.groupId = dotToSlashReplacer((String) getVariableValueFromObject(obj, "groupId"));
-
- this.artifactId = (String) getVariableValueFromObject(obj, "artifactId");
-
- this.version = (String) getVariableValueFromObject(obj, "version");
-
- this.packaging = (String) getVariableValueFromObject(obj, "packaging");
-
- this.classifier = (String) getVariableValueFromObject(obj, "classifier");
-
- this.file = (File) getVariableValueFromObject(obj, "file");
- }
-
- private String dotToSlashReplacer(String parameter) {
- return parameter.replace('.', '/');
- }
+ Files.readAllLines(
+ MojoExtension.getTestFile("plugin-config.xml").toPath()),
+ Files.readAllLines(installedPom.toPath()));
- private MavenSession createMavenSession(String localRepositoryBaseDir) throws NoLocalRepositoryManagerException {
- MavenSession session = mock(MavenSession.class);
- DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
- repositorySession.setLocalRepositoryManager(new EnhancedLocalRepositoryManagerFactory(
- new DefaultLocalPathComposer(),
- new DefaultTrackingFileManager(),
- new DefaultLocalPathPrefixComposerFactory())
- .newInstance(repositorySession, new LocalRepository(localRepositoryBaseDir)));
- ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
- buildingRequest.setRepositorySession(repositorySession);
- when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
- when(session.getRepositorySession()).thenReturn(repositorySession);
- return session;
+ assertEquals(4, FileUtils.getFiles(localRepo, null, null).size());
}
}
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
index d5809672..cd18e235 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
@@ -18,162 +18,151 @@
*/
package org.apache.maven.plugins.install;
+import javax.inject.Inject;
+
import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Build;
import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.model.PluginExecution;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugins.install.stubs.AttachedArtifactStub0;
-import org.apache.maven.plugins.install.stubs.InstallArtifactStub;
-import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.util.FileUtils;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.internal.impl.DefaultLocalPathComposer;
-import org.eclipse.aether.internal.impl.DefaultLocalPathPrefixComposerFactory;
-import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
-import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.mockito.Mockito.lenient;
/**
* @author Allan Ramirez
*/
-public class InstallMojoTest extends AbstractMojoTestCase {
+@MojoTest(realRepositorySession = true)
+class InstallMojoTest {
- InstallArtifactStub artifact;
+ @TempDir
+ private Path tempDir;
- private static final String LOCAL_REPO = "target/local-repo/";
+ @Inject
+ private MavenProject mavenProject;
- public void setUp() throws Exception {
- super.setUp();
-
- FileUtils.deleteDirectory(new File(getBasedir() + "/" + LOCAL_REPO));
- }
+ @Inject
+ private MavenSession mavenSession;
- public void testInstallTestEnvironment() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-test/plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
- }
+ @Inject
+ private MavenProjectHelper mavenProjectHelper;
- public void testBasicInstall() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-test/plugin-config.xml");
+ private File localRepo;
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
+ @BeforeEach
+ void setUp() throws Exception {
+ mavenProject.setGroupId("org.apache.maven.test");
+ mavenProject.setArtifactId("maven-install-test");
+ mavenProject.setVersion("1.0-SNAPSHOT");
+ mavenProject.setPackaging("jar");
- assertNotNull(mojo);
-
- File file = new File(
- getBasedir(),
- "target/test-classes/unit/basic-install-test/target/" + "maven-install-test-1.0-SNAPSHOT.jar");
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
+ Plugin plugin = new Plugin();
+ plugin.setArtifactId("maven-install-plugin");
+ PluginExecution execution = new PluginExecution();
+ execution.setGoals(Collections.singletonList("install"));
+ plugin.setExecutions(Collections.singletonList(execution));
+ mavenProject.getBuild().addPlugin(plugin);
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
+ lenient().when(mavenSession.getProjects()).thenReturn(Collections.singletonList(mavenProject));
- artifact = (InstallArtifactStub) project.getArtifact();
+ localRepo = tempDir.resolve("local-repo").toAbsolutePath().toFile();
+ mavenSession.getRequest().setLocalRepositoryPath(localRepo);
+ }
- artifact.setFile(file);
+ @Test
+ @InjectMojo(goal = "install")
+ void testBasicInstall(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ setProjectArtifact(mavenProject);
mojo.execute();
+ Artifact artifact = mavenProject.getArtifact();
String groupId = dotToSlashReplacer(artifact.getGroupId());
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
+ localRepo,
+ groupId + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
+ artifact.getArtifactId() + "-" + artifact.getVersion() + "."
+ artifact.getArtifactHandler().getExtension());
assertTrue(installedArtifact.exists());
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(5, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testBasicInstallWithAttachedArtifacts() throws Exception {
- File testPom = new File(
- getBasedir(),
- "target/test-classes/unit/basic-install-test-with-attached-artifacts/" + "plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
-
- List attachedArtifacts = project.getAttachedArtifacts();
+ @Test
+ @InjectMojo(goal = "install")
+ void testBasicInstallWithAttachedArtifacts(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ setProjectArtifact(mavenProject);
+
+ mavenProjectHelper.attachArtifact(
+ mavenProject,
+ "jar",
+ "next1",
+ Files.createTempFile(tempDir, "test-artifact1", "jar").toFile());
+ mavenProjectHelper.attachArtifact(
+ mavenProject,
+ "jar",
+ "next2",
+ Files.createTempFile(tempDir, "test-artifact2", "jar").toFile());
mojo.execute();
- String packaging = project.getPackaging();
-
- String groupId;
+ List attachedArtifacts = mavenProject.getAttachedArtifacts();
- for (Object attachedArtifact1 : attachedArtifacts) {
- AttachedArtifactStub0 attachedArtifact = (AttachedArtifactStub0) attachedArtifact1;
+ for (Artifact attachedArtifact : attachedArtifacts) {
- groupId = dotToSlashReplacer(attachedArtifact.getGroupId());
+ String groupId = dotToSlashReplacer(attachedArtifact.getGroupId());
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + attachedArtifact.getArtifactId()
+ localRepo,
+ groupId + "/" + attachedArtifact.getArtifactId()
+ "/" + attachedArtifact.getVersion() + "/" + attachedArtifact.getArtifactId()
- + "-" + attachedArtifact.getVersion() + "." + packaging);
+ + "-" + attachedArtifact.getVersion() + "-" + attachedArtifact.getClassifier()
+ + "." + attachedArtifact.getArtifactHandler().getExtension());
- assertTrue(installedArtifact.getPath() + " does not exist", installedArtifact.exists());
+ assertTrue(installedArtifact.exists(), installedArtifact.getPath() + " does not exist");
}
- assertEquals(13, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(7, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testNonPomInstallWithAttachedArtifactsOnly() throws Exception {
- File testPom = new File(
- getBasedir(),
- "target/test-classes/unit/basic-install-test-with-attached-artifacts/" + "plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
+ @Test
+ @InjectMojo(goal = "install")
+ void testNonPomInstallWithAttachedArtifactsOnly(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ setProjectArtifact(mavenProject);
- assertNotNull(mojo);
+ mavenProjectHelper.attachArtifact(
+ mavenProject,
+ "jar",
+ "next1",
+ Files.createTempFile(tempDir, "test-artifact1", "jar").toFile());
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
- setVariableValueToObject(mojo, "session", createMavenSession());
-
- artifact = (InstallArtifactStub) project.getArtifact();
-
- artifact.setFile(null);
+ mavenProject.getArtifact().setFile(null);
try {
mojo.execute();
@@ -187,58 +176,12 @@ public void testNonPomInstallWithAttachedArtifactsOnly() throws Exception {
}
}
- public void testUpdateReleaseParamSetToTrue() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/configured-install-test/plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- File file = new File(
- getBasedir(),
- "target/test-classes/unit/configured-install-test/target/" + "maven-install-test-1.0-SNAPSHOT.jar");
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
-
- artifact = (InstallArtifactStub) project.getArtifact();
-
- artifact.setFile(file);
-
- mojo.execute();
-
- // assertTrue( artifact.isRelease() );
-
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
- }
-
- public void testInstallIfArtifactFileIsNull() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-test/plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
-
- artifact = (InstallArtifactStub) project.getArtifact();
-
- artifact.setFile(null);
-
- assertNull(artifact.getFile());
+ @Test
+ @InjectMojo(goal = "install")
+ void testInstallIfArtifactFileIsNull(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ setProjectArtifact(mavenProject);
+ mavenProject.getArtifact().setFile(null);
try {
mojo.execute();
@@ -249,27 +192,14 @@ public void testInstallIfArtifactFileIsNull() throws Exception {
"The packaging plugin for project maven-install-test did not assign a file to the build artifact",
e.getMessage());
}
-
- assertFalse(new File(LOCAL_REPO).exists());
}
- public void testInstallIfProjectFileIsNull() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-test/plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
- setVariableValueToObject(mojo, "session", createMavenSession());
-
- project.setFile(null);
-
- assertNull(project.getFile());
+ @Test
+ @InjectMojo(goal = "install")
+ void testInstallIfProjectFileIsNull(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ setProjectArtifact(mavenProject);
+ mavenProject.setFile(null);
try {
mojo.execute();
@@ -280,197 +210,90 @@ public void testInstallIfProjectFileIsNull() throws Exception {
}
}
- public void testInstallIfPackagingIsPom() throws Exception {
- File testPom = new File(
- getBasedir(), "target/test-classes/unit/basic-install-test-packaging-pom/" + "plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
-
- String packaging = project.getPackaging();
-
- assertEquals("pom", packaging);
-
- artifact = (InstallArtifactStub) project.getArtifact();
+ @Test
+ @InjectMojo(goal = "install")
+ void testInstallIfPackagingIsPom(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ mavenProject.setPomFile(
+ Files.createTempFile(tempDir, "test-artifact", "pom").toFile());
+ mavenProject.setPackaging("pom");
mojo.execute();
- String groupId = dotToSlashReplacer(artifact.getGroupId());
+ String groupId = dotToSlashReplacer(mavenProject.getGroupId());
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
- + artifact.getArtifactId() + "-" + artifact.getVersion() + "." + "pom");
+ localRepo,
+ groupId + "/" + mavenProject.getArtifactId() + "/" + mavenProject.getVersion() + "/"
+ + mavenProject.getArtifactId() + "-" + mavenProject.getVersion() + "."
+ + mavenProject.getPackaging());
assertTrue(installedArtifact.exists());
- assertEquals(4, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(4, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testInstallIfPackagingIsBom() throws Exception {
- File testPom = new File(
- getBasedir(), "target/test-classes/unit/basic-install-test-packaging-bom/" + "plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
-
- String packaging = project.getPackaging();
-
- assertEquals("bom", packaging);
-
- artifact = (InstallArtifactStub) project.getArtifact();
+ @Test
+ @InjectMojo(goal = "install")
+ void testInstallIfPackagingIsBom(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ mavenProject.setPomFile(
+ Files.createTempFile(tempDir, "test-artifact", "pom").toFile());
+ mavenProject.setPackaging("bom");
mojo.execute();
- String groupId = dotToSlashReplacer(artifact.getGroupId());
+ String groupId = dotToSlashReplacer(mavenProject.getGroupId());
File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
- + artifact.getArtifactId() + "-" + artifact.getVersion() + "." + "pom");
-
- assertTrue(installedArtifact.exists());
-
- assertEquals(4, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
- }
-
- public void testBasicInstallAndCreate() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-checksum/plugin-config.xml");
-
- AbstractMojo mojo = (AbstractMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- File file = new File(getBasedir(), "target/test-classes/unit/basic-install-checksum/" + "maven-test-jar.jar");
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- MavenSession mavenSession = createMavenSession();
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
-
- artifact = (InstallArtifactStub) project.getArtifact();
-
- artifact.setFile(file);
-
- mojo.execute();
-
- File pom = new File(
- new File(LOCAL_REPO),
- mavenSession
- .getRepositorySession()
- .getLocalRepositoryManager()
- .getPathForLocalArtifact(new DefaultArtifact(
- artifact.getGroupId(), artifact.getArtifactId(), "pom", artifact.getVersion())));
-
- assertTrue(pom.exists());
-
- String groupId = dotToSlashReplacer(artifact.getGroupId());
- String packaging = project.getPackaging();
- String localPath = getBasedir() + "/" + LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/"
- + artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion();
-
- File installedArtifact = new File(localPath + "." + packaging);
+ localRepo,
+ groupId + "/" + mavenProject.getArtifactId() + "/" + mavenProject.getVersion() + "/"
+ + mavenProject.getArtifactId() + "-" + mavenProject.getVersion() + ".pom");
assertTrue(installedArtifact.exists());
- assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
+ assertEquals(4, FileUtils.getFiles(localRepo, null, null).size());
}
- public void testSkip() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-test/plugin-config.xml");
-
- InstallMojo mojo = (InstallMojo) lookupMojo("install", testPom);
-
- assertNotNull(mojo);
-
- File file = new File(
- getBasedir(),
- "target/test-classes/unit/basic-install-test/target/" + "maven-install-test-1.0-SNAPSHOT.jar");
-
- MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
- updateMavenProject(project);
-
- MavenSession session = createMavenSession();
- session.setProjects(Collections.singletonList(project));
- setVariableValueToObject(mojo, "session", session);
- setVariableValueToObject(mojo, "pluginContext", new ConcurrentHashMap<>());
- setVariableValueToObject(mojo, "pluginDescriptor", new PluginDescriptor());
- setVariableValueToObject(mojo, "skip", Boolean.TRUE);
-
- artifact = (InstallArtifactStub) project.getArtifact();
-
- artifact.setFile(file);
+ @Test
+ @InjectMojo(goal = "install")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkip(InstallMojo mojo) throws Exception {
+ mojo.setPluginContext(new HashMap<>());
+ setProjectArtifact(mavenProject);
mojo.execute();
+ Artifact artifact = mavenProject.getArtifact();
String groupId = dotToSlashReplacer(artifact.getGroupId());
- String packaging = project.getPackaging();
+ String packaging = mavenProject.getPackaging();
- File installedArtifact = new File(
- getBasedir(),
- LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
+ File installedArtifact =
+ new File(localRepo + groupId + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
+ artifact.getArtifactId() + "-" + artifact.getVersion() + "." + packaging);
assertFalse(installedArtifact.exists());
- assertFalse(new File(LOCAL_REPO).exists());
+ assertFalse(localRepo.exists());
}
private String dotToSlashReplacer(String parameter) {
return parameter.replace('.', '/');
}
- private MavenSession createMavenSession() throws NoLocalRepositoryManagerException {
- MavenSession session = mock(MavenSession.class);
- DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
- repositorySession.setLocalRepositoryManager(new EnhancedLocalRepositoryManagerFactory(
- new DefaultLocalPathComposer(),
- new DefaultTrackingFileManager(),
- new DefaultLocalPathPrefixComposerFactory())
- .newInstance(repositorySession, new LocalRepository(LOCAL_REPO)));
- ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
- buildingRequest.setRepositorySession(repositorySession);
- when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
- when(session.getRepositorySession()).thenReturn(repositorySession);
- when(session.getPluginContext(any(PluginDescriptor.class), any(MavenProject.class)))
- .thenReturn(new ConcurrentHashMap());
- return session;
- }
-
- private void updateMavenProject(MavenProject project) {
- project.setGroupId(project.getArtifact().getGroupId());
- project.setArtifactId(project.getArtifact().getArtifactId());
- project.setVersion(project.getArtifact().getVersion());
-
- Plugin plugin = new Plugin();
- plugin.setArtifactId("maven-install-plugin");
- project.setBuild(new Build());
- project.getBuild().addPlugin(plugin);
+ private void setProjectArtifact(MavenProject mavenProject) throws IOException {
+ org.apache.maven.artifact.DefaultArtifact artifact = new org.apache.maven.artifact.DefaultArtifact(
+ mavenProject.getGroupId(),
+ mavenProject.getArtifactId(),
+ mavenProject.getVersion(),
+ null,
+ "jar",
+ null,
+ new DefaultArtifactHandler("jar"));
+ artifact.setFile(Files.createTempFile(tempDir, "test-artifact", "jar").toFile());
+ mavenProject.setArtifact(artifact);
+ mavenProject.setPomFile(
+ Files.createTempFile(tempDir, "test-artifact", "pom").toFile());
}
}
diff --git a/src/test/java/org/apache/maven/plugins/install/stubs/AttachedArtifactStub0.java b/src/test/java/org/apache/maven/plugins/install/stubs/AttachedArtifactStub0.java
deleted file mode 100644
index 53f30b4e..00000000
--- a/src/test/java/org/apache/maven/plugins/install/stubs/AttachedArtifactStub0.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.install.stubs;
-
-import java.io.File;
-
-public class AttachedArtifactStub0 extends InstallArtifactStub {
- public String getArtifactId() {
- return "attached-artifact-test-0";
- }
-
- public File getFile() {
- return new File(
- System.getProperty("basedir"),
- "target/test-classes/unit/basic-install-test-with-attached-artifacts/"
- + "target/maven-install-test-1.0-SNAPSHOT.jar");
- }
-}
diff --git a/src/test/java/org/apache/maven/plugins/install/stubs/AttachedArtifactStub1.java b/src/test/java/org/apache/maven/plugins/install/stubs/AttachedArtifactStub1.java
deleted file mode 100644
index ad869b8c..00000000
--- a/src/test/java/org/apache/maven/plugins/install/stubs/AttachedArtifactStub1.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.install.stubs;
-
-public class AttachedArtifactStub1 extends AttachedArtifactStub0 {
- public String getArtifactId() {
- return "attached-artifact-test-1";
- }
-}
diff --git a/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java b/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java
deleted file mode 100644
index 46d58c48..00000000
--- a/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.install.stubs;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-
-public class InstallArtifactStub extends ArtifactStub {
- private Map