You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2023/06/06 13:57:22 UTC
[maven-build-cache-extension] branch guava created (now 724a5d5)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch guava
in repository https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git
at 724a5d5 Remove undeclared Guava dependency with Arrays.asList
This branch includes the following new commits:
new 724a5d5 Remove undeclared Guava dependency with Arrays.asList
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-build-cache-extension] 01/01: Remove undeclared Guava dependency with Arrays.asList
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch guava
in repository https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git
commit 724a5d5ddd3b2ae3988d0878252eab2610c3d0c4
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Tue Jun 6 09:57:09 2023 -0400
Remove undeclared Guava dependency with Arrays.asList
---
.../BuildCacheMojosExecutionStrategyTest.java | 18 ++++++-------
.../buildcache/LifecyclePhasesHelperTest.java | 30 +++++++++++-----------
.../java/org/apache/maven/buildcache/TestMojo.java | 5 ++--
.../maven/buildcache/its/ForkedExecutionsTest.java | 4 +--
4 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/src/test/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategyTest.java b/src/test/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategyTest.java
index 380c0b2..b0a4f42 100644
--- a/src/test/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategyTest.java
+++ b/src/test/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategyTest.java
@@ -20,10 +20,10 @@ package org.apache.maven.buildcache;
import java.io.File;
import java.nio.file.Paths;
+import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
-import com.google.common.collect.Lists;
import org.apache.commons.lang3.SystemUtils;
import org.apache.maven.buildcache.xml.CacheConfig;
import org.apache.maven.buildcache.xml.build.CompletedExecution;
@@ -74,7 +74,7 @@ class BuildCacheMojosExecutionStrategyTest {
boolean windows = SystemUtils.IS_OS_WINDOWS;
- List<Pair<TrackedProperty, PropertyValue>> cacheProperties = Lists.newArrayList(
+ List<Pair<TrackedProperty, PropertyValue>> cacheProperties = Arrays.asList(
setupProperty("bool", "true"),
setupProperty("primitive", "1"),
setupProperty("file", "c"),
@@ -101,7 +101,7 @@ class BuildCacheMojosExecutionStrategyTest {
? Paths.get("c:\\a\\b\\c").toFile()
: Paths.get("/a/b/c").toFile(),
Paths.get(windows ? "..\\d\\e" : "../d/e"),
- Lists.newArrayList("a", "b", "c"),
+ Arrays.<String>asList("a", "b", "c"),
new String[] {"c", "d", "e"});
assertTrue(strategy.isParamsMatched(projectMock, executionMock, testMojo, cacheRecordMock));
@@ -121,8 +121,8 @@ class BuildCacheMojosExecutionStrategyTest {
cache.setName(propertyName);
cache.setValue("false");
- when(cacheConfigMock.getTrackedProperties(executionMock)).thenReturn(Lists.newArrayList(config));
- when(cacheRecordMock.getProperties()).thenReturn(Lists.newArrayList(cache));
+ when(cacheConfigMock.getTrackedProperties(executionMock)).thenReturn(Arrays.asList(config));
+ when(cacheRecordMock.getProperties()).thenReturn(Arrays.asList(cache));
when(projectMock.getBasedir()).thenReturn(new File("."));
@@ -150,8 +150,8 @@ class BuildCacheMojosExecutionStrategyTest {
cache.setName(propertyName);
cache.setValue(null);
- when(cacheConfigMock.getTrackedProperties(executionMock)).thenReturn(Lists.newArrayList(config));
- when(cacheRecordMock.getProperties()).thenReturn(Lists.newArrayList(cache));
+ when(cacheConfigMock.getTrackedProperties(executionMock)).thenReturn(Arrays.asList(config));
+ when(cacheRecordMock.getProperties()).thenReturn(Arrays.asList(cache));
when(projectMock.getBasedir()).thenReturn(new File("."));
@@ -177,8 +177,8 @@ class BuildCacheMojosExecutionStrategyTest {
cache.setName(propertyName);
cache.setValue("1");
- when(cacheConfigMock.getTrackedProperties(executionMock)).thenReturn(Lists.newArrayList(config));
- when(cacheRecordMock.getProperties()).thenReturn(Lists.newArrayList(cache));
+ when(cacheConfigMock.getTrackedProperties(executionMock)).thenReturn(Arrays.asList(config));
+ when(cacheRecordMock.getProperties()).thenReturn(Arrays.asList(cache));
when(projectMock.getBasedir()).thenReturn(new File("."));
diff --git a/src/test/java/org/apache/maven/buildcache/LifecyclePhasesHelperTest.java b/src/test/java/org/apache/maven/buildcache/LifecyclePhasesHelperTest.java
index 9cca493..17e63c6 100644
--- a/src/test/java/org/apache/maven/buildcache/LifecyclePhasesHelperTest.java
+++ b/src/test/java/org/apache/maven/buildcache/LifecyclePhasesHelperTest.java
@@ -19,9 +19,9 @@
package org.apache.maven.buildcache;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
-import com.google.common.collect.Lists;
import org.apache.maven.buildcache.xml.Build;
import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.execution.MavenSession;
@@ -77,7 +77,7 @@ class LifecyclePhasesHelperTest {
void resolveHighestLifecyclePhaseNormal() {
String phase = lifecyclePhasesHelper.resolveHighestLifecyclePhase(
projectMock,
- Lists.newArrayList(
+ Arrays.asList(
mockedMojoExecution("clean"), mockedMojoExecution("compile"), mockedMojoExecution("install")));
assertEquals("install", phase);
}
@@ -92,7 +92,7 @@ class LifecyclePhasesHelperTest {
publishForkedProjectEvent(origin);
String phase = lifecyclePhasesHelper.resolveHighestLifecyclePhase(
- projectMock, Lists.newArrayList(mockedMojoExecution(null)));
+ projectMock, Arrays.asList(mockedMojoExecution(null)));
assertEquals("install", phase);
}
@@ -175,7 +175,7 @@ class LifecyclePhasesHelperTest {
void getCleanSegment() {
MojoExecution clean = mockedMojoExecution("clean");
List<MojoExecution> cleanSegment = lifecyclePhasesHelper.getCleanSegment(
- projectMock, Lists.newArrayList(clean, mockedMojoExecution("compile"), mockedMojoExecution("install")));
+ projectMock, Arrays.asList(clean, mockedMojoExecution("compile"), mockedMojoExecution("install")));
assertEquals(singletonList(clean), cleanSegment);
}
@@ -185,7 +185,7 @@ class LifecyclePhasesHelperTest {
@Test
void getEmptyCleanSegment() {
List<MojoExecution> cleanSegment = lifecyclePhasesHelper.getCleanSegment(
- projectMock, Lists.newArrayList(mockedMojoExecution("compile"), mockedMojoExecution("install")));
+ projectMock, Arrays.asList(mockedMojoExecution("compile"), mockedMojoExecution("install")));
assertEquals(emptyList(), cleanSegment);
}
@@ -200,7 +200,7 @@ class LifecyclePhasesHelperTest {
List<MojoExecution> cleanSegment = lifecyclePhasesHelper.getCleanSegment(
projectMock,
- Lists.newArrayList(
+ Arrays.asList(
// null lifecycle phase is possible in forked executions
mockedMojoExecution(null), mockedMojoExecution(null)));
@@ -217,7 +217,7 @@ class LifecyclePhasesHelperTest {
List<MojoExecution> cleanSegment = lifecyclePhasesHelper.getCleanSegment(
projectMock,
- Lists.newArrayList(
+ Arrays.asList(
// clean is overridden to "install" phase assuming forked execution
mockedMojoExecution("clean")));
@@ -228,7 +228,7 @@ class LifecyclePhasesHelperTest {
void testCachedSegment() {
MojoExecution compile = mockedMojoExecution("compile");
MojoExecution test = mockedMojoExecution("test");
- List<MojoExecution> mojoExecutions = Lists.newArrayList(compile, test, mockedMojoExecution("install"));
+ List<MojoExecution> mojoExecutions = Arrays.asList(compile, test, mockedMojoExecution("install"));
Build build = mock(Build.class);
when(build.getHighestCompletedGoal()).thenReturn("test");
@@ -243,7 +243,7 @@ class LifecyclePhasesHelperTest {
MojoExecution compile = mockedMojoExecution("compile");
MojoExecution test = mockedMojoExecution("test");
MojoExecution install = mockedMojoExecution("install");
- List<MojoExecution> mojoExecutions = Lists.newArrayList(compile, test, install);
+ List<MojoExecution> mojoExecutions = Arrays.asList(compile, test, install);
Build build = mock(Build.class);
when(build.getHighestCompletedGoal()).thenReturn("clean");
@@ -258,7 +258,7 @@ class LifecyclePhasesHelperTest {
MojoExecution me1 = mockedMojoExecution(null);
MojoExecution me2 = mockedMojoExecution(null);
- List<MojoExecution> mojoExecutions = Lists.newArrayList(me1, me2);
+ List<MojoExecution> mojoExecutions = Arrays.asList(me1, me2);
MojoExecution origin = mockedMojoExecution("install");
publishForkedProjectEvent(origin);
@@ -277,7 +277,7 @@ class LifecyclePhasesHelperTest {
MojoExecution compile = mockedMojoExecution("compile");
MojoExecution test = mockedMojoExecution("test");
MojoExecution install = mockedMojoExecution("install");
- List<MojoExecution> mojoExecutions = Lists.newArrayList(compile, test, install);
+ List<MojoExecution> mojoExecutions = Arrays.asList(compile, test, install);
Build build = mock(Build.class);
when(build.getHighestCompletedGoal()).thenReturn("site");
@@ -292,7 +292,7 @@ class LifecyclePhasesHelperTest {
MojoExecution compile = mockedMojoExecution("compile");
MojoExecution test = mockedMojoExecution("test");
MojoExecution install = mockedMojoExecution("install");
- List<MojoExecution> mojoExecutions = Lists.newArrayList(compile, test, install);
+ List<MojoExecution> mojoExecutions = Arrays.asList(compile, test, install);
Build build = mock(Build.class);
when(build.getHighestCompletedGoal()).thenReturn("compile");
@@ -308,7 +308,7 @@ class LifecyclePhasesHelperTest {
MojoExecution compile = mockedMojoExecution("compile");
MojoExecution test = mockedMojoExecution("test");
MojoExecution install = mockedMojoExecution("install");
- List<MojoExecution> mojoExecutions = Lists.newArrayList(compile, test, install);
+ List<MojoExecution> mojoExecutions = Arrays.asList(compile, test, install);
Build build = mock(Build.class);
when(build.getHighestCompletedGoal()).thenReturn("clean");
@@ -324,7 +324,7 @@ class LifecyclePhasesHelperTest {
MojoExecution me1 = mockedMojoExecution(null);
MojoExecution me2 = mockedMojoExecution(null);
- List<MojoExecution> mojoExecutions = Lists.newArrayList(me1, me2);
+ List<MojoExecution> mojoExecutions = Arrays.asList(me1, me2);
MojoExecution origin = mockedMojoExecution("install");
publishForkedProjectEvent(origin);
@@ -344,7 +344,7 @@ class LifecyclePhasesHelperTest {
MojoExecution compile = mockedMojoExecution("compile");
MojoExecution test = mockedMojoExecution("test");
MojoExecution install = mockedMojoExecution("install");
- List<MojoExecution> mojoExecutions = Lists.newArrayList(compile, test, install);
+ List<MojoExecution> mojoExecutions = Arrays.asList(compile, test, install);
Build cachedBuild = mock(Build.class);
when(cachedBuild.getHighestCompletedGoal()).thenReturn("install");
diff --git a/src/test/java/org/apache/maven/buildcache/TestMojo.java b/src/test/java/org/apache/maven/buildcache/TestMojo.java
index 560426c..6298d01 100644
--- a/src/test/java/org/apache/maven/buildcache/TestMojo.java
+++ b/src/test/java/org/apache/maven/buildcache/TestMojo.java
@@ -20,7 +20,6 @@ package org.apache.maven.buildcache;
import java.io.File;
import java.nio.file.Path;
-import java.util.ArrayList;
import java.util.List;
import org.apache.maven.plugin.Mojo;
@@ -42,7 +41,7 @@ public class TestMojo implements Mojo {
public TestMojo() {}
- public TestMojo(boolean bool, int primitive, File file, Path path, ArrayList<String> list, String[] array) {
+ public TestMojo(boolean bool, int primitive, File file, Path path, List<String> list, String[] array) {
this.bool = bool;
this.primitive = primitive;
@@ -53,7 +52,7 @@ public class TestMojo implements Mojo {
}
public static TestMojo create(
- boolean bool, int primitive, File file, Path path, ArrayList<String> list, String[] array) {
+ boolean bool, int primitive, File file, Path path, List<String> list, String[] array) {
return new TestMojo(bool, primitive, file, path, list, array);
}
diff --git a/src/test/java/org/apache/maven/buildcache/its/ForkedExecutionsTest.java b/src/test/java/org/apache/maven/buildcache/its/ForkedExecutionsTest.java
index 627dd8a..d56dd66 100644
--- a/src/test/java/org/apache/maven/buildcache/its/ForkedExecutionsTest.java
+++ b/src/test/java/org/apache/maven/buildcache/its/ForkedExecutionsTest.java
@@ -21,11 +21,11 @@ package org.apache.maven.buildcache.its;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Arrays;
import com.github.tomakehurst.wiremock.common.ConsoleNotifier;
import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
import com.github.tomakehurst.wiremock.matching.UrlPathPattern;
-import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils;
import org.apache.maven.buildcache.its.junit.IntegrationTest;
import org.apache.maven.it.VerificationException;
@@ -87,7 +87,7 @@ public class ForkedExecutionsTest {
verifier.setLogFileName("../log-1.txt");
verifier.setMavenDebug(true);
- verifier.setCliOptions(Lists.newArrayList(
+ verifier.setCliOptions(Arrays.asList(
"-Dmaven.build.cache.location=" + tempDirectory.toAbsolutePath(),
"-Dmaven.build.cache.remote.url=http:////localhost:"
+ wm.getRuntimeInfo().getHttpPort(),