Skip to content

Commit e26b400

Browse files
committed
reduce usage of Guava
1 parent d6750d3 commit e26b400

21 files changed

Lines changed: 82 additions & 106 deletions

File tree

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/escaping/AnyEscapingStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
*/
2020
package io.wcm.devops.conga.plugins.aem.handlebars.escaping;
2121

22+
import java.util.Map;
23+
2224
import org.apache.commons.text.translate.CharSequenceTranslator;
2325
import org.apache.commons.text.translate.LookupTranslator;
2426

25-
import com.google.common.collect.ImmutableMap;
26-
2727
import io.wcm.devops.conga.generator.spi.handlebars.EscapingStrategyPlugin;
2828
import io.wcm.devops.conga.generator.spi.handlebars.context.EscapingStrategyContext;
2929
import io.wcm.devops.conga.generator.util.FileUtil;
@@ -44,7 +44,7 @@ public class AnyEscapingStrategy implements EscapingStrategyPlugin {
4444
* Defines translations for strings in ANY files.
4545
*/
4646
private static final CharSequenceTranslator ESCAPE_ANY =
47-
new LookupTranslator(ImmutableMap.of(
47+
new LookupTranslator(Map.of(
4848
"\"", "\\\"",
4949
"\\", "\\\\"));
5050

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AbstractCloudManagerConditionalHelper.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.github.jknack.handlebars.Context;
3030
import com.github.jknack.handlebars.Options;
3131
import com.github.jknack.handlebars.Options.Buffer;
32-
import com.google.common.collect.ImmutableList;
3332
import com.google.common.collect.ImmutableMap;
3433

3534
import io.wcm.devops.conga.generator.spi.handlebars.HelperPlugin;
@@ -45,7 +44,7 @@ abstract class AbstractCloudManagerConditionalHelper implements HelperPlugin<Obj
4544

4645
static final String HTTPD_KEY = "httpd";
4746
static final String CLOUD_MANAGER_CONDITIONAL_KEY = "cloudManagerConditional";
48-
static final List<String> ENVIRONMENTS = ImmutableList.of("dev", "stage", "prod");
47+
static final List<String> ENVIRONMENTS = List.of("dev", "stage", "prod");
4948

5049
@Override
5150
@SuppressWarnings("unchecked")
@@ -96,7 +95,7 @@ protected abstract void renderBodyContent(Buffer buffer, CharSequence bodyConten
9695

9796
private List<CloudManagerConditional> getCloudManagerConditional(Map<String, Object> cloudManagerConditional) {
9897
return ENVIRONMENTS.stream()
99-
.map(env -> new CloudManagerConditional(env, cloudManagerConditional.getOrDefault(env, ImmutableMap.of())))
98+
.map(env -> new CloudManagerConditional(env, cloudManagerConditional.getOrDefault(env, Map.of())))
10099
.collect(Collectors.toList());
101100
}
102101

@@ -115,7 +114,7 @@ private static class CloudManagerConditional {
115114
this.config = (Map<String, Object>)value;
116115
}
117116
else {
118-
this.config = ImmutableMap.of();
117+
this.config = Map.of();
119118
}
120119
}
121120

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackagePropertiesPostProcessor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import org.apache.commons.lang3.StringUtils;
3030
import org.slf4j.Logger;
3131

32-
import com.google.common.collect.ImmutableList;
33-
3432
import io.wcm.devops.conga.generator.GeneratorException;
3533
import io.wcm.devops.conga.generator.plugins.postprocessor.AbstractPostProcessor;
3634
import io.wcm.devops.conga.generator.spi.ImplicitApplyOptions;
@@ -103,7 +101,7 @@ public List<FileContext> apply(FileContext fileContext, PostProcessorContext con
103101
throw new GeneratorException("Unable to extract properties from AEM package " + fileContext.getCanonicalPath(), ex);
104102
}
105103

106-
return ImmutableList.of();
104+
return List.of();
107105
}
108106

109107
}

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/util/ContentPackageUtil.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
import org.apache.commons.lang3.BooleanUtils;
5252
import org.apache.commons.lang3.StringUtils;
5353

54-
import com.google.common.collect.ImmutableMap;
55-
5654
import io.wcm.devops.conga.generator.GeneratorException;
5755
import io.wcm.devops.conga.generator.UrlFileManager;
5856
import io.wcm.devops.conga.generator.spi.context.FileHeaderContext;
@@ -230,7 +228,7 @@ else if (rootPath != null) {
230228
private static Map<String,Object> getAdditionalyProperties(Map<String, Object> options) {
231229
Map<String, Object> props = getOptionalPropMap(options, PROPERTY_PACKAGE_PROPERTIES);
232230
if (props == null) {
233-
props = ImmutableMap.of();
231+
props = Map.of();
234232
}
235233
return props;
236234
}

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/util/JsonContentLoader.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
import org.apache.sling.contentparser.json.JSONParserOptions;
3535
import org.apache.sling.contentparser.json.internal.JSONContentParser;
3636

37-
import com.google.common.collect.ImmutableSet;
38-
3937
import io.wcm.devops.conga.generator.GeneratorException;
4038
import io.wcm.devops.conga.generator.util.FileUtil;
4139
import io.wcm.tooling.commons.contentpackagebuilder.element.ContentElement;
@@ -45,7 +43,7 @@
4543
*/
4644
public final class JsonContentLoader {
4745

48-
private static final Set<String> IGNORED_NAMES = ImmutableSet.of(
46+
private static final Set<String> IGNORED_NAMES = Set.of(
4947
JcrConstants.JCR_BASEVERSION,
5048
JcrConstants.JCR_PREDECESSORS,
5149
JcrConstants.JCR_SUCCESSORS,

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/validator/ContentPackageValidator.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import org.apache.maven.plugin.MojoExecutionException;
3636
import org.apache.maven.plugin.MojoFailureException;
3737

38-
import com.google.common.collect.ImmutableMap;
39-
4038
import io.wcm.devops.conga.generator.spi.ImplicitApplyOptions;
4139
import io.wcm.devops.conga.generator.spi.ValidationException;
4240
import io.wcm.devops.conga.generator.spi.ValidatorPlugin;
@@ -63,8 +61,8 @@ public class ContentPackageValidator implements ValidatorPlugin {
6361
private static final String OPTION_VALIDATORS_SETTINGS = "contentPackage.validatorsSettings";
6462

6563
// apply default validation for AEM and wcm.io node types
66-
private static final Map<String, Object> DEFAULT_VALIDATORS_SETTINGS = ImmutableMap.of("jackrabbit-nodetypes",
67-
ImmutableMap.of("options", ImmutableMap.of("cnds", "tccl:aem.cnd,tccl:wcmio.cnd")));
64+
private static final Map<String, Object> DEFAULT_VALIDATORS_SETTINGS = Map.of("jackrabbit-nodetypes",
65+
Map.of("options", Map.of("cnds", "tccl:aem.cnd,tccl:wcmio.cnd")));
6866

6967
@Override
7068
public String getName() {

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/fileheader/AnyFileHeaderTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import org.junit.jupiter.api.BeforeEach;
3131
import org.junit.jupiter.api.Test;
3232

33-
import com.google.common.collect.ImmutableList;
34-
3533
import io.wcm.devops.conga.generator.spi.FileHeaderPlugin;
3634
import io.wcm.devops.conga.generator.spi.context.FileContext;
3735
import io.wcm.devops.conga.generator.spi.context.FileHeaderContext;
@@ -51,7 +49,7 @@ void testApply() throws Exception {
5149
File file = new File("target/generation-test/fileHeader.any");
5250
FileUtils.write(file, "myany { }", StandardCharsets.UTF_8);
5351

54-
List<String> lines = ImmutableList.of("Der Jodelkaiser", "aus dem Oetztal", "ist wieder daheim.");
52+
List<String> lines = List.of("Der Jodelkaiser", "aus dem Oetztal", "ist wieder daheim.");
5553
FileHeaderContext context = new FileHeaderContext().commentLines(lines);
5654
FileContext fileContext = new FileContext().file(file);
5755

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemCryptoEncryptHelperTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@
3030
import static org.junit.jupiter.api.Assertions.assertTrue;
3131

3232
import java.io.IOException;
33+
import java.util.Map;
3334

3435
import org.junit.jupiter.api.BeforeEach;
3536
import org.junit.jupiter.api.Test;
3637

37-
import com.google.common.collect.ImmutableMap;
38-
3938
import io.wcm.devops.conga.generator.UrlFileManager;
4039
import io.wcm.devops.conga.generator.spi.context.PluginContextOptions;
4140
import io.wcm.devops.conga.generator.spi.context.UrlFilePluginContext;
@@ -82,15 +81,15 @@ void testWithoutKey() throws Exception {
8281
@Test
8382
void testWithoutKey_Skip() throws Exception {
8483
pluginContext.getGenericPluginConfig().put(PLUGIN_NAME,
85-
ImmutableMap.of(PARAMETER_CRYPTO_SKIP, true));
84+
Map.of(PARAMETER_CRYPTO_SKIP, true));
8685

8786
assertHelper(INPUT, helper, INPUT, new MockOptions(), pluginContext);
8887
}
8988

9089
@Test
9190
void testEncrypt() throws Exception {
9291
pluginContext.getGenericPluginConfig().put(PLUGIN_NAME,
93-
ImmutableMap.of(PARAMETER_CRYPTO_AES_KEY_URL, "classpath:/crypto/master"));
92+
Map.of(PARAMETER_CRYPTO_AES_KEY_URL, "classpath:/crypto/master"));
9493

9594
String encrypted = (String)executeHelper(helper, INPUT, new MockOptions(), pluginContext);
9695
assertTrue(CryptoString.isCryptoString(encrypted));
@@ -99,7 +98,7 @@ void testEncrypt() throws Exception {
9998
@Test
10099
void testEncrypt_Skip() throws Exception {
101100
pluginContext.getGenericPluginConfig().put(PLUGIN_NAME,
102-
ImmutableMap.of(PARAMETER_CRYPTO_AES_KEY_URL, "classpath:/crypto/master",
101+
Map.of(PARAMETER_CRYPTO_AES_KEY_URL, "classpath:/crypto/master",
103102
PARAMETER_CRYPTO_SKIP, "true"));
104103

105104
assertHelper(INPUT, helper, INPUT, new MockOptions(), pluginContext);

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemDispatcherFilterHelperTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.junit.jupiter.api.BeforeEach;
2828
import org.junit.jupiter.api.Test;
2929

30-
import com.google.common.collect.ImmutableMap;
31-
3230
import io.wcm.devops.conga.generator.spi.handlebars.HelperPlugin;
3331
import io.wcm.devops.conga.generator.util.PluginManagerImpl;
3432

@@ -45,7 +43,7 @@ void setUp() {
4543
@Test
4644
void testUrl() throws Exception {
4745
assertHelper("{ /type \"allow\" /url '/abc(/.*)?' }",
48-
helper, ImmutableMap.of("type", "allow", "url", "/abc(/.*)?"), new MockOptions());
46+
helper, Map.of("type", "allow", "url", "/abc(/.*)?"), new MockOptions());
4947
}
5048

5149
@Test

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemHttpdFilterHelperTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
import static io.wcm.devops.conga.plugins.aem.handlebars.helper.TestUtils.assertHelper;
2323

24+
import java.util.Map;
25+
2426
import org.junit.jupiter.api.BeforeEach;
2527
import org.junit.jupiter.api.Test;
2628

27-
import com.google.common.collect.ImmutableMap;
28-
2929
import io.wcm.devops.conga.generator.spi.handlebars.HelperPlugin;
3030
import io.wcm.devops.conga.generator.util.PluginManagerImpl;
3131

@@ -49,7 +49,7 @@ void testLocation() throws Exception {
4949
" Require all granted\n" +
5050
" </IfVersion>\n" +
5151
"</Location>",
52-
helper, ImmutableMap.of("type", "allow", "location", "/abc"), new MockOptions());
52+
helper, Map.of("type", "allow", "location", "/abc"), new MockOptions());
5353
}
5454

5555
@Test
@@ -63,7 +63,7 @@ void testLocationMatch() throws Exception {
6363
" Require all denied\n" +
6464
" </IfVersion>\n" +
6565
"</LocationMatch>",
66-
helper, ImmutableMap.of("type", "deny", "locationMatch", "/abc(/.*)?"), new MockOptions());
66+
helper, Map.of("type", "deny", "locationMatch", "/abc(/.*)?"), new MockOptions());
6767
}
6868

6969
@Test
@@ -77,7 +77,7 @@ void testLocationDenyAllowAdmin_NoHash() throws Exception {
7777
" Require all denied\n" +
7878
" </IfVersion>\n" +
7979
"</Location>",
80-
helper, ImmutableMap.of("type", "deny_allow_admin", "location", "/abc"), new MockOptions());
80+
helper, Map.of("type", "deny_allow_admin", "location", "/abc"), new MockOptions());
8181
}
8282

8383
@Test
@@ -95,7 +95,7 @@ void testLocationDenyAllowAdmin() throws Exception {
9595
" Require host myhost\n" +
9696
" </IfVersion>\n" +
9797
"</Location>",
98-
helper, ImmutableMap.of("type", "deny_allow_admin", "location", "/abc"), new MockOptions()
98+
helper, Map.of("type", "deny_allow_admin", "location", "/abc"), new MockOptions()
9999
.withHash(AemHttpdFilterHelper.HASH_ALLOW_FROM_KEY, "allowFrom")
100100
.withHash(AemHttpdFilterHelper.HASH_ALLOW_FROM_HOST_KEY, "allowFromHost")
101101
.withProperty("allowFrom", "1.2.3.4")

0 commit comments

Comments
 (0)