Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Jan 8, 2025
1 parent 6cffd9a commit f887c33
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void testArtifactReplacementExecution() throws Exception {
Verifier v0 = newVerifier(testDir.getAbsolutePath());
v0.setAutoclean(false);
v0.deleteDirectory("target");
v0.deleteArtifacts("org.apache.maven.its.mng5387");
v0.deleteArtifacts("org.apache.maven.its.mng5387", null);
v0.addCliArgument("install");
v0.execute();
v0.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testitMNG5639() throws Exception {
File testDir = extractResources("/mng-5639-import-scope-pom-resolution");

Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.deleteArtifacts("org.apache.maven.its.mng5639");
verifier.deleteArtifacts("org.apache.maven.its.mng5639", "maven-core-it");

verifier.filterFile("settings-template.xml", "settings.xml");
verifier.addCliArgument("--settings");
Expand All @@ -47,6 +47,6 @@ public void testitMNG5639() throws Exception {
verifier.execute();
verifier.verifyErrorFreeLog();

verifier.verifyArtifactPresent("org.apache.maven.its.mng5639", "b", "0.1", "jar");
verifier.verifyArtifactPresent("org.apache.maven.its.mng5639", "b", "0.1", "jar", "maven-core-it");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public void testitMNG5639() throws Exception {
File testDir = extractResources("/mng-5663-nested-import-scope-pom-resolution");

Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.deleteArtifacts("org.apache.maven.its.mng5663");
verifier.deleteArtifacts("org.apache.maven.its.mng5663", "maven-core-it");
verifier.deleteArtifacts("org.apache.maven.its.mng5663", "repo-2");

verifier.filterFile("pom-template.xml", "pom.xml");
verifier.filterFile("settings-template.xml", "settings.xml");
Expand All @@ -53,6 +54,6 @@ public void testitMNG5639() throws Exception {
verifier.execute();
verifier.verifyErrorFreeLog();

verifier.verifyArtifactPresent("org.apache.maven.its.mng5663", "c", "0.1", "jar");
verifier.verifyArtifactPresent("org.apache.maven.its.mng5663", "c", "0.1", "jar", "repo-2");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void testWithBuildConsumer() throws Exception {
Verifier verifier = newVerifier(testDir.getAbsolutePath(), false);
Map<String, String> filterProperties = Collections.singletonMap(
"${javaAgentJar}",
verifier.getArtifactPath("org.apache.maven.its", "core-it-javaagent", "2.1-SNAPSHOT", "jar"));
verifier.getSupportArtifactPath("org.apache.maven.its", "core-it-javaagent", "2.1-SNAPSHOT", "jar"));
verifier.filterFile(".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties);

verifier.setLogFileName("log-bc.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testCoreExtension() throws Exception {

verifier = newVerifier(new File(testDir, "client").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.addCliArgument("validate");
Expand All @@ -59,7 +59,7 @@ public void testCoreExtensionNoDescriptor() throws Exception {

verifier = newVerifier(new File(testDir, "client-no-descriptor").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.addCliArgument("validate");
Expand Down Expand Up @@ -99,7 +99,7 @@ public void testCoreExtensionRetrievedFromAMirrorWithBasicAuthentication() throw

verifier = newVerifier(new File(testDir, "client").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions", "repoman");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.addCliArgument("validate");
Expand All @@ -123,7 +123,7 @@ public void testCoreExtensionWithProperties() throws Exception {

verifier = newVerifier(new File(testDir, "client-properties").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.addCliArgument("-Dtest-extension-version=0.1");
Expand All @@ -146,7 +146,7 @@ public void testCoreExtensionWithConfig() throws Exception {

verifier = newVerifier(new File(testDir, "client-config").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.setForkJvm(true); // force forked JVM since we need the shell script to detect .mvn/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testBehaviourWhereThereIsOneUserSuppliedConfigurationProcessor() thr

verifier = newVerifier(new File(testDir, "build-with-one-processor-valid").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-configuration-processors");
verifier.deleteArtifacts("org.apache.maven.its.it-configuration-processors", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.addCliArgument("process-resources");
Expand All @@ -62,7 +62,7 @@ public void testBehaviourWhereThereAreTwoUserSuppliedConfigurationProcessor() th

verifier = newVerifier(new File(testDir, "build-with-two-processors-invalid").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-configuration-processors");
verifier.deleteArtifacts("org.apache.maven.its.it-configuration-processors", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void testNoDeployNotDuplicate() throws Exception {

verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.mng5868");
verifier.deleteArtifacts("org.apache.maven.its.mng5868", null);
verifier.addCliArgument("-Dartifact.attachedFile=" + tmp.toFile().getCanonicalPath());
verifier.addCliArgument("-DdeploymentPort=" + port);
verifier.addCliArguments("org.apache.maven.its.plugins:maven-it-plugin-artifact:2.1-SNAPSHOT:attach", "deploy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testJsr250PluginExecution() throws Exception {
Verifier v0 = newVerifier(testDir.getAbsolutePath());
v0.setAutoclean(false);
v0.deleteDirectory("target");
v0.deleteArtifacts("org.apache.maven.its.mng6084");
v0.deleteArtifacts("org.apache.maven.its.mng6084", null);
v0.addCliArgument("install");
v0.execute();
v0.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testCoreExtensionCustomScopes() throws Exception {

verifier = newVerifier(new File(testDir, "client").getAbsolutePath());
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions-custom-scopes");
verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions-custom-scopes", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath());
verifier.addCliArgument("validate");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testArtifactsHaveSameTimestamp() throws Exception {
final Path remoteRepoDir = Paths.get(verifier.getBasedir(), "repo");

verifier.deleteDirectory("repo");
verifier.deleteArtifacts("org.apache.maven.its.mng6754");
verifier.deleteArtifacts("org.apache.maven.its.mng6754", null);
verifier.addCliArgument("-Drepodir=" + remoteRepoDir);
verifier.addCliArgument("deploy");
verifier.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testitInProject() throws Exception {

final Verifier verifier = newVerifier(testDir.getAbsolutePath(), null);
overrideGlobalSettings(testDir, verifier);
verifier.deleteArtifacts("org.apache.maven.its.mng6772");
verifier.deleteArtifacts("org.apache.maven.its.mng6772", "central");

verifier.filterFile("pom-template.xml", "pom.xml");

Expand All @@ -63,7 +63,7 @@ public void testitInDependency() throws Exception {

final Verifier verifier = newVerifier(testDir.getAbsolutePath(), null);
overrideGlobalSettings(testDir, verifier);
verifier.deleteArtifacts("org.apache.maven.its.mng6772");
verifier.deleteArtifacts("org.apache.maven.its.mng6772", "central");

verifier.filterFile("pom-template.xml", "pom.xml");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,62 +75,82 @@ public void testPublishedPoms() throws Exception {
assertTextEquals(
new File(testDir, "expected/parent.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom")));
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom", null)));

assertTextEquals(
new File(testDir, "expected/parent-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
"org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom", "build", null)));

assertTextEquals(
new File(testDir, "expected/simple-parent.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom")));
"org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom", null)));

assertTextEquals(
new File(testDir, "expected/simple-parent-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
"org.sonatype.mavenbook.multi",
"simple-parent",
"0.9-MNG6957-SNAPSHOT",
"pom",
"build",
null)));

assertTextEquals(
new File(testDir, "expected/simple-weather.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom")));
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom", null)));

assertTextEquals(
new File(testDir, "expected/simple-weather-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
"org.sonatype.mavenbook.multi",
"simple-weather",
"0.9-MNG6957-SNAPSHOT",
"pom",
"build",
null)));

assertTextEquals(
new File(testDir, "expected/simple-webapp.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom")));
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom", null)));

assertTextEquals(
new File(testDir, "expected/simple-webapp-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
"org.sonatype.mavenbook.multi",
"simple-webapp",
"0.9-MNG6957-SNAPSHOT",
"pom",
"build",
null)));

assertTextEquals(
new File(testDir, "expected/simple-testutils.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom")));
"org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom", null)));

assertTextEquals(
new File(testDir, "expected/simple-testutils-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
"org.sonatype.mavenbook.multi",
"simple-testutils",
"0.9-MNG6957-SNAPSHOT",
"pom",
"build",
null)));

assertTextEquals(
new File(testDir, "expected/utils-parent.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom")));
"org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom", null)));

assertTextEquals(
new File(testDir, "expected/utils-parent-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom", "build")));
"org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom", "build", null)));
}

static void assertTextEquals(File file1, File file2) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void testit() throws Exception {
* makes it easy to do this.
*/
verifier = newVerifier(testDir.getAbsolutePath());
verifier.deleteArtifact("mng-6972-allow-access-to-graph-package", "build-plugin", "1.0", "jar");
verifier.deleteArtifact("mng-6972-allow-access-to-graph-package", "using-module", "1.0", "jar");
verifier.deleteArtifact("mng-6972-allow-access-to-graph-package", "build-plugin", "1.0", "jar", null);
verifier.deleteArtifact("mng-6972-allow-access-to-graph-package", "using-module", "1.0", "jar", null);

verifier = newVerifier(new File(testDir.getAbsolutePath(), "build-plugin").getAbsolutePath());
verifier.getSystemProperties().put("maven.multiModuleProjectDirectory", testDir.getAbsolutePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void testit() throws Exception {
Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.mng7529");
verifier.deleteArtifacts("org.apache.maven.its.mng7529", "maven-core-it");
verifier.deleteArtifacts("org.apache.maven.its.mng7529", "maven-core-it-snapshots");
verifier.addCliArgument("--settings");
verifier.addCliArgument("settings.xml");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void testitMojoExecution() throws Exception {
Verifier verifier = newVerifier(new File(testDir, "test-1").getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.mng7566");
verifier.deleteArtifacts("org.apache.maven.its.mng7566", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument("settings.xml");
verifier.filterFile("../settings-template.xml", "settings.xml");
Expand All @@ -72,7 +72,7 @@ void testitPluginVersionResolution() throws Exception {
Verifier verifier = newVerifier(new File(testDir, "test-2").getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteArtifacts("org.apache.maven.its.mng7566");
verifier.deleteArtifacts("org.apache.maven.its.mng7566", "maven-core-it");
verifier.addCliArgument("-s");
verifier.addCliArgument("settings.xml");
verifier.filterFile("../settings-template.xml", "settings.xml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void testDependencyResolution() throws Exception {

Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(true);
verifier.deleteArtifacts("org.apache.maven.its.mng7606");
verifier.deleteArtifacts("org.apache.maven.its.mng7606", null);
verifier.addCliArgument("verify");
verifier.execute();
verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ void testFileLockingAndSnapshots() throws Exception {

// produce required precondition state: local repository must not have any of the org.apache.maven.its.mng7819
// artifacts
String path = verifier.getArtifactPath("org.apache.maven.its.mng7819", "dependency", "1.0.0-SNAPSHOT", "pom");
String path = verifier.getArtifactPath(
"org.apache.maven.its.mng7819", "dependency", "1.0.0-SNAPSHOT", "pom", "maven-core-it");
File groupDirectory = new File(path).getParentFile().getParentFile().getParentFile();
FileUtils.deleteDirectory(groupDirectory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ void testAlternativeSyntax() throws Exception {
consumerVerifier.addCliArgument("-V");

Path consumerPom = Paths.get(consumerVerifier.getArtifactPath(
"org.apache.maven.its.mng-7836", "hocon-simple", "1.0.0-SNAPSHOT", "pom", ""));
"org.apache.maven.its.mng-7836", "hocon-simple", "1.0.0-SNAPSHOT", "pom", "", null));
Path buildPom = Paths.get(consumerVerifier.getArtifactPath(
"org.apache.maven.its.mng-7836", "hocon-simple", "1.0.0-SNAPSHOT", "pom", "build"));
consumerVerifier.deleteArtifacts("org.apache.maven.its.mng-7836", "hocon-simple", "1.0.0-SNAPSHOT");
"org.apache.maven.its.mng-7836", "hocon-simple", "1.0.0-SNAPSHOT", "pom", "build", null));
consumerVerifier.deleteArtifacts("org.apache.maven.its.mng-7836", "hocon-simple", "1.0.0-SNAPSHOT", null);

consumerVerifier.execute();
consumerVerifier.verifyErrorFreeLog();
Expand Down
Loading

0 comments on commit f887c33

Please sign in to comment.