Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use varargs for localRepositoryTail #43420

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public T setLocalRepository(String localRepo) {
* @return this instance
*/
@SuppressWarnings("unchecked")
public T setLocalRepositoryTail(String[] localRepoTail) {
public T setLocalRepositoryTail(String... localRepoTail) {
this.localRepoTail = localRepoTail;
return (T) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void testValidTailViaSystemProp() throws Exception {
public void testValidTailViaConfig() throws Exception {
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_1));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -83,11 +83,11 @@ public void testValidTailViaConfig() throws Exception {
public void testValidTailResolutionOrder() throws Exception {
final BootstrapMavenContext mvnLocal1first = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_1, M2_LOCAL_2 }));
.setLocalRepositoryTail(M2_LOCAL_1, M2_LOCAL_2));

final BootstrapMavenContext mvnLocal2first = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_2, M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_2, M2_LOCAL_1));

assertEquals(resolveOrgAcmeFooJar001(mvnLocal1first).getFile().getAbsolutePath(),
Paths.get(M2_LOCAL_1, "org", "acme", "foo", "0.0.1", "foo-0.0.1.jar").toAbsolutePath().toString());
Expand All @@ -99,7 +99,7 @@ public void testValidTailResolutionOrder() throws Exception {
public void testValidTailMultiplicity() throws Exception {
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_1, M2_LOCAL_2 }));
.setLocalRepositoryTail(M2_LOCAL_1, M2_LOCAL_2));

final Artifact foo = resolveOrgAcmeFooJar001(mvn);
assertNotNull(foo);
Expand All @@ -119,7 +119,7 @@ public void testValidTailLocalCheckingForAvailabilityViaConfig() throws Exceptio
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(false)
.setLocalRepositoryTail(new String[] { M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_1));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -129,7 +129,7 @@ public void testValidTailFromRemoteCheckingForAvailabilityViaConfig() throws Exc
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(false)
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertThrowsExactly(BootstrapMavenException.class, () -> resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -139,7 +139,7 @@ public void testValidTailFromRemoteCheckingForAvailabilityViaSystemProp() throws
setSystemProp("maven.repo.local.tail.ignoreAvailability", "false");
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertThrowsExactly(BootstrapMavenException.class, () -> resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -149,7 +149,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaSystemPropEmpty() thro
setSystemProp("maven.repo.local.tail.ignoreAvailability", ""); // will become `true`
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -159,7 +159,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaSystemPropBlank() thro
setSystemProp("maven.repo.local.tail.ignoreAvailability", " "); // will become `true`
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -169,7 +169,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaSystemPropTruthy() thr
setSystemProp("maven.repo.local.tail.ignoreAvailability", "fals"); // will become `true`
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -179,7 +179,7 @@ public void testValidTailLocalIgnoringAvailabilityViaConfig() throws Exception {
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(true)
.setLocalRepositoryTail(new String[] { M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_1));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -189,7 +189,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaConfig() throws Except
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(true)
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand Down
Loading