Skip to content

Commit b77b5ce

Browse files
Eliminate usage of Guava (#61)
1 parent 358a5bd commit b77b5ce

9 files changed

Lines changed: 20 additions & 40 deletions

File tree

changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<action type="update" dev="sseifert">
2828
Switch to latest Maven APIs to handle build output timestamp.
2929
</action>
30+
<action type="update" dev="sseifert">
31+
Eliminate usage of Guava.
32+
</action>
3033
</release>
3134

3235
<release version="2.19.4" date="2023-03-27">

conga-aem-plugin/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@
6767
<scope>compile</scope>
6868
</dependency>
6969

70-
<dependency>
71-
<groupId>com.google.guava</groupId>
72-
<artifactId>guava</artifactId>
73-
<scope>compile</scope>
74-
</dependency>
75-
7670
<dependency>
7771
<groupId>org.apache.jackrabbit</groupId>
7872
<artifactId>filevault-package-maven-plugin</artifactId>

parent/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@
8888
<version>2.1.6</version>
8989
</dependency>
9090

91-
<dependency>
92-
<groupId>com.google.guava</groupId>
93-
<artifactId>guava</artifactId>
94-
<version>32.1.1-jre</version>
95-
</dependency>
96-
9791
<dependency>
9892
<groupId>org.apache.jackrabbit</groupId>
9993
<artifactId>filevault-package-maven-plugin</artifactId>

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/AbstractCloudManagerMojo.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import org.apache.maven.plugin.MojoExecutionException;
3333
import org.apache.maven.plugins.annotations.Parameter;
3434

35-
import com.google.common.collect.ImmutableSet;
36-
3735
/**
3836
* Common functionality for mojos that generate configuration ZIP files for Adobe Cloud Manager.
3937
*/
@@ -128,10 +126,10 @@ protected List<File> getNodeDirs(File environmentDir) {
128126

129127
private static Set<String> toSet(String[] values) {
130128
if (values != null) {
131-
return ImmutableSet.copyOf(values);
129+
return Set.of(values);
132130
}
133131
else {
134-
return ImmutableSet.of();
132+
return Set.of();
135133
}
136134
}
137135

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/AbstractContentPackageMojo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import static io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory.COMPOSUM_URL;
2323
import static io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory.CRX_URL;
2424

25+
import java.util.List;
26+
2527
import org.apache.commons.lang3.StringUtils;
2628
import org.apache.maven.execution.MavenSession;
2729
import org.apache.maven.plugin.AbstractMojo;
@@ -30,8 +32,6 @@
3032
import org.apache.maven.plugins.annotations.Parameter;
3133
import org.apache.maven.settings.crypto.SettingsDecrypter;
3234

33-
import com.google.common.collect.ImmutableList;
34-
3535
import io.wcm.tooling.commons.packmgr.PackageManagerProperties;
3636
import io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory;
3737
import io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory.Service;
@@ -237,8 +237,8 @@ protected PackageManagerProperties getPackageManagerProperties() throws MojoExec
237237
props.setRetryDelaySec(this.retryDelay);
238238
props.setBundleStatusUrl(buildBundleStatusUrl());
239239
props.setBundleStatusWaitLimitSec(this.bundleStatusWaitLimit);
240-
props.setBundleStatusBlacklistBundleNames(ImmutableList.copyOf(this.bundleStatusBlacklistBundleNames));
241-
props.setBundleStatusWhitelistBundleNames(ImmutableList.copyOf(this.bundleStatusWhitelistBundleNames));
240+
props.setBundleStatusBlacklistBundleNames(List.of(this.bundleStatusBlacklistBundleNames));
241+
props.setBundleStatusWhitelistBundleNames(List.of(this.bundleStatusWhitelistBundleNames));
242242
props.setPackageManagerInstallStatusURL(buildPackageManagerInstallStatusUrl());
243243
props.setPackageManagerInstallStatusWaitLimitSec(this.packageManagerInstallStatusWaitLimit);
244244
props.setRelaxedSSLCheck(this.relaxedSSLCheck);

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/AllPackageBuilder.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@
6464
import org.jetbrains.annotations.NotNull;
6565
import org.jetbrains.annotations.Nullable;
6666

67-
import com.google.common.collect.ImmutableSet;
68-
6967
import io.wcm.devops.conga.plugins.aem.maven.AutoDependenciesMode;
7068
import io.wcm.devops.conga.plugins.aem.maven.BuildOutputTimestamp;
7169
import io.wcm.devops.conga.plugins.aem.maven.PackageTypeValidation;
@@ -113,7 +111,7 @@ public final class AllPackageBuilder {
113111
private BuildOutputTimestamp buildOutputTimestamp;
114112

115113
private static final String RUNMODE_DEFAULT = "$default$";
116-
private static final Set<String> ALLOWED_PACKAGE_TYPES = ImmutableSet.of(
114+
private static final Set<String> ALLOWED_PACKAGE_TYPES = Set.of(
117115
PackageType.APPLICATION.name().toLowerCase(),
118116
PackageType.CONTAINER.name().toLowerCase(),
119117
PackageType.CONTENT.name().toLowerCase());

tooling/conga-aem-maven-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/AllPackageBuilderTest.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.io.File;
3030
import java.io.IOException;
3131
import java.util.List;
32+
import java.util.Map;
3233
import java.util.Set;
3334
import java.util.stream.Stream;
3435

@@ -40,10 +41,6 @@
4041
import org.junit.jupiter.params.provider.MethodSource;
4142
import org.zeroturnaround.zip.ZipUtil;
4243

43-
import com.google.common.collect.ImmutableList;
44-
import com.google.common.collect.ImmutableMap;
45-
import com.google.common.collect.ImmutableSet;
46-
4744
import io.wcm.devops.conga.plugins.aem.maven.AutoDependenciesMode;
4845
import io.wcm.devops.conga.plugins.aem.maven.model.InstallableFile;
4946
import io.wcm.devops.conga.plugins.aem.maven.model.ModelParser;
@@ -69,9 +66,9 @@ void setUp(TestInfo testInfo) throws IOException {
6966
private static Stream<Arguments> cloudManagerTargetVariants() {
7067
return Stream.of(
7168
// test with no environment (=all environments)
72-
Arguments.of(ImmutableSet.of(), ImmutableList.of(".author")),
69+
Arguments.of(Set.of(), List.of(".author")),
7370
// test with two environments
74-
Arguments.of(ImmutableSet.of("stage", "prod"), ImmutableList.of(".author.stage", ".author.prod")));
71+
Arguments.of(Set.of("stage", "prod"), List.of(".author.stage", ".author.prod")));
7572
}
7673

7774
@ParameterizedTest
@@ -82,7 +79,7 @@ void testBuild_AUTODEPENDENCIES_OFF(Set<String> cloudManagerTarget, List<String>
8279

8380
AllPackageBuilder builder = new AllPackageBuilder(targetFile, "test-group", "test-pkg");
8481
builder.add(files, cloudManagerTarget);
85-
assertTrue(builder.build(ImmutableMap.of("prop1", "value1")));
82+
assertTrue(builder.build(Map.of("prop1", "value1")));
8683

8784
ZipUtil.unpack(targetFile, targetUnpackDir);
8885

tooling/conga-aem-maven-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/FileTestUtil.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
import org.jetbrains.annotations.Nullable;
3737
import org.w3c.dom.Document;
3838

39-
import com.google.common.collect.ImmutableSet;
40-
import com.google.common.collect.ImmutableSortedSet;
41-
4239
public final class FileTestUtil {
4340

4441
private FileTestUtil() {
@@ -78,7 +75,7 @@ public static void assertFiles(File dir, String runmodeSuffix, ExpectedFile... e
7875
.map(file -> file.getFileName(runmodeSuffix))
7976
.collect(Collectors.toCollection(TreeSet::new));
8077
String[] fileNames = dir.list();
81-
Set<String> actualFileNames = fileNames != null ? ImmutableSortedSet.copyOf(fileNames) : ImmutableSet.of();
78+
Set<String> actualFileNames = fileNames != null ? new TreeSet<>(Set.of(fileNames)) : Set.of();
8279
assertEquals(expectedFileNames, actualFileNames, "files in " + dir.getPath());
8380

8481
// extra check for content packages
@@ -118,7 +115,7 @@ public static void assertFiles(File dir, String runmodeSuffix, ExpectedFile... e
118115
public static void assertDirectories(File dir, String... fileNames) {
119116
assertTrue(dir.exists(), "directory exists: " + dir.getPath());
120117
assertTrue(dir.isDirectory(), "is directory: " + dir.getPath());
121-
Set<String> expectedDirectoryNames = ImmutableSet.copyOf(fileNames);
118+
Set<String> expectedDirectoryNames = Set.of(fileNames);
122119
Set<String> actualDirectoryNames = Collections.emptySet();
123120
File[] files = dir.listFiles();
124121
if (files != null) {

tooling/conga-aem-maven-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/maven/model/ModelParserTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@
2626

2727
import java.io.File;
2828
import java.util.List;
29+
import java.util.Set;
2930

3031
import org.apache.commons.lang3.StringUtils;
3132
import org.junit.jupiter.api.BeforeEach;
3233
import org.junit.jupiter.api.Test;
3334

34-
import com.google.common.collect.ImmutableSet;
35-
3635
class ModelParserTest {
3736

3837
private File nodeDir;
@@ -69,7 +68,7 @@ void testGetContentPackagesForNode() {
6968
assertBundle(files.get(12), "bundles/io.wcm.wcm.ui.granite-1.9.2.jar");
7069

7170
ModelContentPackageFile pkg6 = (ModelContentPackageFile)files.get(6);
72-
assertEquals(ImmutableSet.of("aem-author"), pkg6.getVariants());
71+
assertEquals(Set.of("aem-author"), pkg6.getVariants());
7372
assertEquals(false, pkg6.getInstall());
7473
assertEquals(true, pkg6.getRecursive());
7574
assertEquals(30, pkg6.getDelayAfterInstallSec());
@@ -79,7 +78,7 @@ void testGetContentPackagesForNode() {
7978
assertEquals("1.3.1-SNAPSHOT", pkg6.getVersion());
8079

8180
BundleFile bundle12 = (BundleFile)files.get(12);
82-
assertEquals(ImmutableSet.of("aem-author"), bundle12.getVariants());
81+
assertEquals(Set.of("aem-author"), bundle12.getVariants());
8382
assertEquals(false, bundle12.getInstall());
8483
}
8584

@@ -110,7 +109,7 @@ void testHasRole() {
110109

111110
@Test
112111
void testGetCloudManagerTarget() {
113-
assertEquals(ImmutableSet.of("stage", "prod"), nodeModelParser.getCloudManagerTarget());
112+
assertEquals(Set.of("stage", "prod"), nodeModelParser.getCloudManagerTarget());
114113
assertTrue(dispatcherNodeModelParser.getCloudManagerTarget().isEmpty());
115114
}
116115

0 commit comments

Comments
 (0)