This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git
The following commit(s) were added to refs/heads/master by this push:
new 9361858 [MBUILDCACHE-60] Remove undeclared Guava dependency with
Arrays.asList (#86)
9361858 is described below
commit 936185808372e3bbaa0b854895c19ef681846dd8
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Fri Aug 11 16:18:43 2023 +0000
[MBUILDCACHE-60] Remove undeclared Guava dependency with Arrays.asList (#86)
---
.../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 ff633bb..dbd9a8e 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;
@@ -76,7 +76,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"),
@@ -103,7 +103,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));
@@ -123,8 +123,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("."));
@@ -152,8 +152,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("."));
@@ -179,8 +179,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(),