This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch maven-install-plugin-3.x
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
The following commit(s) were added to refs/heads/maven-install-plugin-3.x by
this push:
new 52448a2 Migration to JUnit 5 - avoid using AbstractMojoTestCase (#396)
52448a2 is described below
commit 52448a275c06c6f305bbd3abb2576fa7d0d76c88
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Mon Mar 16 17:41:52 2026 +0100
Migration to JUnit 5 - avoid using AbstractMojoTestCase (#396)
---
pom.xml | 24 +-
.../maven/plugins/install/InstallFileMojoTest.java | 382 +++++-----------
.../maven/plugins/install/InstallMojoTest.java | 485 +++++++--------------
.../install/stubs/AttachedArtifactStub0.java | 34 --
.../install/stubs/AttachedArtifactStub1.java | 25 --
.../plugins/install/stubs/InstallArtifactStub.java | 99 -----
.../install/stubs/InstallBomArtifactStub.java | 37 --
.../install/stubs/InstallPomArtifactStub.java | 37 --
.../unit/basic-install-checksum/maven-test-jar.jar | 1 -
.../unit/basic-install-checksum/plugin-config.xml | 35 --
.../plugin-config.xml | 35 --
.../plugin-config.xml | 35 --
.../plugin-config.xml | 42 --
.../unit/basic-install-test/plugin-config.xml | 35 --
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin 2372 -> 0 bytes
.../unit/configured-install-test/plugin-config.xml | 35 --
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin 2372 -> 0 bytes
.../unit/install-file-basic-test/plugin-config.xml | 35 --
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin 2372 -> 0 bytes
.../plugin-config.xml | 35 --
.../maven-install-test-1.0-SNAPSHOT.jar | Bin 2372 -> 0 bytes
.../plugin-config.xml | 37 --
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin 1244 -> 0 bytes
.../plugin-config.xml | 7 -
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin
.../install-file-with-checksum/maven-test-jar.jar | 1 -
.../install-file-with-checksum/plugin-config.xml | 35 --
.../install-file-with-classifier/plugin-config.xml | 36 --
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin 2372 -> 0 bytes
.../plugin-config.xml | Bin 2934 -> 0 bytes
.../target/maven-install-test-1.0-SNAPSHOT.jar | Bin 2372 -> 0 bytes
31 files changed, 280 insertions(+), 1247 deletions(-)
diff --git a/pom.xml b/pom.xml
index c38e0c1..11db2af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,6 +132,12 @@
<!-- To work in Maven versions older than 3.9.0 -->
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -156,9 +162,8 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -167,13 +172,6 @@
<version>3.5.1</version>
<scope>test</scope>
</dependency>
- <dependency>
- <!-- used by maven-plugin-testing-harness, don't give it compile scope!
-->
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-compat</artifactId>
- <version>${mavenVersion}</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
@@ -186,12 +184,6 @@
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-impl</artifactId>
- <version>${resolverVersion}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<profiles>
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 3ec2fe3..52a048a 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 <a href="mailto:[email protected]">Allan Ramirez</a>
*/
-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 d580967..cd18e23 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 <a href="mailto:[email protected]">Allan Ramirez</a>
*/
-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<Artifact> 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<Artifact> 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 class InstallMojoTest extends AbstractMojoTestCase
{
}
}
- 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 class InstallMojoTest extends AbstractMojoTestCase
{
"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 class InstallMojoTest extends
AbstractMojoTestCase {
}
}
- 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<String, Object>());
- 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 53f30b4..0000000
---
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 ad869b8..0000000
---
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 46d58c4..0000000
---
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<Object, ArtifactMetadata> metadataMap;
-
- private File file;
-
- private boolean release;
-
- public String getArtifactId() {
- return "maven-install-test";
- }
-
- public String getGroupId() {
- return "org.apache.maven.test";
- }
-
- public String getVersion() {
- return "1.0-SNAPSHOT";
- }
-
- public String getBaseVersion() {
- return getVersion();
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- public File getFile() {
- return file;
- }
-
- public String getType() {
- return "jar";
- }
-
- public ArtifactHandler getArtifactHandler() {
- return new DefaultArtifactHandler() {
- public String getExtension() {
- return "jar";
- }
- };
- }
-
- public void addMetadata(ArtifactMetadata metadata) {
- if (metadataMap == null) {
- metadataMap = new HashMap<>();
- }
-
- ArtifactMetadata m = metadataMap.get(metadata.getKey());
- if (m != null) {
- m.merge(metadata);
- } else {
- metadataMap.put(metadata.getKey(), metadata);
- }
- }
-
- public Collection<ArtifactMetadata> getMetadataList() {
- return metadataMap == null ? Collections.emptyList() :
metadataMap.values();
- }
-
- public boolean isRelease() {
- return release;
- }
-
- public void setRelease(boolean release) {
- this.release = release;
- }
-}
diff --git
a/src/test/java/org/apache/maven/plugins/install/stubs/InstallBomArtifactStub.java
b/src/test/java/org/apache/maven/plugins/install/stubs/InstallBomArtifactStub.java
deleted file mode 100644
index 7980b95..0000000
---
a/src/test/java/org/apache/maven/plugins/install/stubs/InstallBomArtifactStub.java
+++ /dev/null
@@ -1,37 +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 org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-
-public class InstallBomArtifactStub extends InstallArtifactStub {
-
- public String getType() {
- return "bom";
- }
-
- public ArtifactHandler getArtifactHandler() {
- return new DefaultArtifactHandler() {
- public String getExtension() {
- return "pom";
- }
- };
- }
-}
diff --git
a/src/test/java/org/apache/maven/plugins/install/stubs/InstallPomArtifactStub.java
b/src/test/java/org/apache/maven/plugins/install/stubs/InstallPomArtifactStub.java
deleted file mode 100644
index df6abd5..0000000
---
a/src/test/java/org/apache/maven/plugins/install/stubs/InstallPomArtifactStub.java
+++ /dev/null
@@ -1,37 +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 org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-
-public class InstallPomArtifactStub extends InstallArtifactStub {
-
- public String getType() {
- return "pom";
- }
-
- public ArtifactHandler getArtifactHandler() {
- return new DefaultArtifactHandler() {
- public String getExtension() {
- return "pom";
- }
- };
- }
-}
diff --git a/src/test/resources/unit/basic-install-checksum/maven-test-jar.jar
b/src/test/resources/unit/basic-install-checksum/maven-test-jar.jar
deleted file mode 100644
index 5be5453..0000000
--- a/src/test/resources/unit/basic-install-checksum/maven-test-jar.jar
+++ /dev/null
@@ -1 +0,0 @@
-this is just a test jar
\ No newline at end of file
diff --git a/src/test/resources/unit/basic-install-checksum/plugin-config.xml
b/src/test/resources/unit/basic-install-checksum/plugin-config.xml
deleted file mode 100644
index 6b4b56c..0000000
--- a/src/test/resources/unit/basic-install-checksum/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
-
<file>${basedir}/src/test/resources/unit/basic-install-checksum/plugin-config.xml</file>
- <packaging>jar</packaging>
- <artifact
implementation="org.apache.maven.plugins.install.stubs.InstallArtifactStub"/>
- <attachedArtifacts/>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/basic-install-test-packaging-bom/plugin-config.xml
b/src/test/resources/unit/basic-install-test-packaging-bom/plugin-config.xml
deleted file mode 100644
index 6c08d07..0000000
--- a/src/test/resources/unit/basic-install-test-packaging-bom/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
-
<file>${basedir}/src/test/resources/unit/basic-install-test-packaging-bom/plugin-config.xml</file>
- <packaging>bom</packaging>
- <artifact
implementation="org.apache.maven.plugins.install.stubs.InstallBomArtifactStub"/>
- <attachedArtifacts/>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
b/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
deleted file mode 100644
index 647ddab..0000000
--- a/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
-
<file>${basedir}/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml</file>
- <packaging>pom</packaging>
- <artifact
implementation="org.apache.maven.plugins.install.stubs.InstallPomArtifactStub"/>
- <attachedArtifacts/>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
b/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
deleted file mode 100644
index 30113ec..0000000
---
a/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
+++ /dev/null
@@ -1,42 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
-
<file>${basedir}/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml</file>
- <packaging>jar</packaging>
- <artifact
implementation="org.apache.maven.plugins.install.stubs.InstallArtifactStub">
-
<file>${basedir}/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml</file>
- </artifact>
- <attachedArtifacts>
- <attachedArtifact
-
implementation="org.apache.maven.plugins.install.stubs.AttachedArtifactStub0"/>
- <attachedArtifact
-
implementation="org.apache.maven.plugins.install.stubs.AttachedArtifactStub1"/>
- </attachedArtifacts>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/test/resources/unit/basic-install-test/plugin-config.xml
b/src/test/resources/unit/basic-install-test/plugin-config.xml
deleted file mode 100644
index c95dccc..0000000
--- a/src/test/resources/unit/basic-install-test/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
-
<file>${basedir}/src/test/resources/unit/basic-install-test/plugin-config.xml</file>
- <packaging>jar</packaging>
- <artifact
implementation="org.apache.maven.plugins.install.stubs.InstallArtifactStub"/>
- <attachedArtifacts/>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 4a0e834..0000000
Binary files
a/src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ
diff --git a/src/test/resources/unit/configured-install-test/plugin-config.xml
b/src/test/resources/unit/configured-install-test/plugin-config.xml
deleted file mode 100644
index 2cc19ac..0000000
--- a/src/test/resources/unit/configured-install-test/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
-
<file>${basedir}/src/test/resources/unit/configured-install-test/plugin-config.xml</file>
- <packaging>jar</packaging>
- <artifact
implementation="org.apache.maven.plugins.install.stubs.InstallArtifactStub"/>
- <attachedArtifacts/>
- </project>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/configured-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/configured-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 4a0e834..0000000
Binary files
a/src/test/resources/unit/configured-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ
diff --git a/src/test/resources/unit/install-file-basic-test/plugin-config.xml
b/src/test/resources/unit/install-file-basic-test/plugin-config.xml
deleted file mode 100644
index 4052343..0000000
--- a/src/test/resources/unit/install-file-basic-test/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <groupId>org.apache.maven.test</groupId>
- <artifactId>maven-install-file-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
<file>${basedir}/target/test-classes/unit/install-file-basic-test/target/maven-install-test-1.0-SNAPSHOT.jar
- </file>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/install-file-basic-test/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/install-file-basic-test/target/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 4a0e834..0000000
Binary files
a/src/test/resources/unit/install-file-basic-test/target/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ
diff --git
a/src/test/resources/unit/install-file-from-local-repository-test/plugin-config.xml
b/src/test/resources/unit/install-file-from-local-repository-test/plugin-config.xml
deleted file mode 100644
index 31ddebf..0000000
---
a/src/test/resources/unit/install-file-from-local-repository-test/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <groupId>org.apache.maven.test</groupId>
- <artifactId>maven-install-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
<file>${basedir}/target/test-classes/unit/install-file-from-local-repository-test/target/org/apache/maven/test/maven-install-test/1.0-SNAPSHOT/maven-install-test-1.0-SNAPSHOT.jar
- </file>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/install-file-from-local-repository-test/target/org/apache/maven/test/maven-install-test/1.0-SNAPSHOT/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/install-file-from-local-repository-test/target/org/apache/maven/test/maven-install-test/1.0-SNAPSHOT/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 4a0e834..0000000
Binary files
a/src/test/resources/unit/install-file-from-local-repository-test/target/org/apache/maven/test/maven-install-test/1.0-SNAPSHOT/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ
diff --git
a/src/test/resources/unit/install-file-test-generatePom/plugin-config.xml
b/src/test/resources/unit/install-file-test-generatePom/plugin-config.xml
deleted file mode 100644
index f6624f6..0000000
--- a/src/test/resources/unit/install-file-test-generatePom/plugin-config.xml
+++ /dev/null
@@ -1,37 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <groupId>org.apache.maven.test</groupId>
- <artifactId>maven-install-file-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <file>
-
${basedir}/src/test/resources/unit/install-file-test-generatePom/target/maven-install-test-1.0-SNAPSHOT.jar
- </file>
- <generatePom>true</generatePom>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/install-file-test-generatePom/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/install-file-test-generatePom/target/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 9c1e111..0000000
Binary files
a/src/test/resources/unit/install-file-test-generatePom/target/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ
diff --git
a/src/test/resources/unit/install-file-with-pom-as-packaging/plugin-config.xml
b/src/test/resources/unit/install-file-test/plugin-config.xml
similarity index 72%
rename from
src/test/resources/unit/install-file-with-pom-as-packaging/plugin-config.xml
rename to src/test/resources/unit/install-file-test/plugin-config.xml
index 4ec759d..b72dc78 100644
---
a/src/test/resources/unit/install-file-with-pom-as-packaging/plugin-config.xml
+++ b/src/test/resources/unit/install-file-test/plugin-config.xml
@@ -21,13 +21,6 @@ under the License.
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
- <configuration>
- <groupId>org.apache.maven.test</groupId>
- <artifactId>maven-install-file-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
<file>${basedir}/src/test/resources/unit/install-file-with-pomFile-test/plugin-config.xml</file>
- </configuration>
</plugin>
</plugins>
</build>
diff --git
a/src/test/resources/unit/basic-install-test-with-attached-artifacts/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/install-file-test/target/maven-install-test-1.0-SNAPSHOT.jar
similarity index 100%
rename from
src/test/resources/unit/basic-install-test-with-attached-artifacts/target/maven-install-test-1.0-SNAPSHOT.jar
rename to
src/test/resources/unit/install-file-test/target/maven-install-test-1.0-SNAPSHOT.jar
diff --git
a/src/test/resources/unit/install-file-with-checksum/maven-test-jar.jar
b/src/test/resources/unit/install-file-with-checksum/maven-test-jar.jar
deleted file mode 100644
index 5be5453..0000000
--- a/src/test/resources/unit/install-file-with-checksum/maven-test-jar.jar
+++ /dev/null
@@ -1 +0,0 @@
-this is just a test jar
\ No newline at end of file
diff --git
a/src/test/resources/unit/install-file-with-checksum/plugin-config.xml
b/src/test/resources/unit/install-file-with-checksum/plugin-config.xml
deleted file mode 100644
index 91655ef..0000000
--- a/src/test/resources/unit/install-file-with-checksum/plugin-config.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <groupId>org.apache.maven.test</groupId>
- <artifactId>maven-install-file-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
<file>${basedir}/src/test/resources/unit/install-file-with-checksum/maven-test-jar.jar</file>
- <generatePom>true</generatePom>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
b/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
deleted file mode 100644
index 8d6a18e..0000000
--- a/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <groupId>org.apache.maven.test</groupId>
- <artifactId>maven-install-file-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <classifier>sources</classifier>
-
<file>${basedir}/target/test-classes/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar
- </file>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 4a0e834..0000000
Binary files
a/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ
diff --git
a/src/test/resources/unit/install-file-with-pomFile-test/plugin-config.xml
b/src/test/resources/unit/install-file-with-pomFile-test/plugin-config.xml
deleted file mode 100644
index fc7c108..0000000
Binary files
a/src/test/resources/unit/install-file-with-pomFile-test/plugin-config.xml and
/dev/null differ
diff --git
a/src/test/resources/unit/install-file-with-pomFile-test/target/maven-install-test-1.0-SNAPSHOT.jar
b/src/test/resources/unit/install-file-with-pomFile-test/target/maven-install-test-1.0-SNAPSHOT.jar
deleted file mode 100644
index 4a0e834..0000000
Binary files
a/src/test/resources/unit/install-file-with-pomFile-test/target/maven-install-test-1.0-SNAPSHOT.jar
and /dev/null differ