You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2024/12/27 11:01:53 UTC
(jackrabbit-oak) 01/01: OAK-11328: Remove usage of Guava ImmutableList (test classes)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-11328
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 68bc40f21e092a7f1cf0ddde7e68404c56de6470
Author: Julian Reschke <re...@apache.org>
AuthorDate: Fri Dec 27 12:01:29 2024 +0100
OAK-11328: Remove usage of Guava ImmutableList (test classes)
---
.../external/ExternalIdentityRefTest.java | 5 +-
.../external/TestIdentityProvider.java | 7 +-
.../external/basic/DefaultSyncContextTest.java | 3 +-
.../external/impl/AbstractDynamicTest.java | 10 +-
.../impl/CustomCredentialsSupportTest.java | 3 +-
.../external/impl/DynamicGroupsTest.java | 6 +-
.../external/impl/DynamicSyncContextTest.java | 4 +-
.../impl/principal/DynamicGroupValidatorTest.java | 3 +-
.../ExternalGroupPrincipalProviderTest.java | 3 +-
.../impl/principal/ExternalGroupPrincipalTest.java | 11 +-
.../principal/ExternalIdentityValidatorTest.java | 11 +-
.../PrincipalProviderAutoMembershipTest.java | 3 +-
.../impl/principal/ValidatorNoProtectionTest.java | 4 +-
.../impl/principal/ValidatorNotDynamicTest.java | 5 +-
.../authorization/cug/impl/AccessControlTest.java | 3 +-
.../cug/impl/CugAccessControlManagerTest.java | 7 +-
.../cug/impl/CugConfigurationTest.java | 3 +-
.../authorization/cug/impl/CugContextTest.java | 7 +-
.../authorization/cug/impl/CugEvaluationTest.java | 15 ++-
.../cug/impl/CugPermissionProviderTest.java | 5 +-
.../authorization/cug/impl/CugValidatorTest.java | 23 +++--
.../authorization/cug/impl/NestedCugHookTest.java | 10 +-
.../security/authorization/cug/impl/NoCugTest.java | 3 +-
.../authorization/cug/impl/SupportedPathsTest.java | 5 +-
.../authorization/cug/impl/TopLevelPathTest.java | 3 +-
.../authorization/cug/impl/VersionTest.java | 5 +-
.../impl/AccessControlManagerLimitedUserTest.java | 8 +-
.../principalbased/impl/MockUtility.java | 4 +-
.../principalbased/impl/PolicyValidatorTest.java | 7 +-
.../PrincipalBasedAccessControlManagerTest.java | 6 +-
.../impl/PrincipalPolicyImplTest.java | 4 +-
.../impl/PrincipalPolicyImporterTest.java | 8 +-
.../oak/blob/cloud/s3/S3DataStoreUtils.java | 3 +-
...aredDataStoreMarkSweepGarbageCollectorTest.java | 10 +-
.../blob/datastore/DataStoreBlobStoreTest.java | 4 +-
.../commons/FileLineDifferenceIteratorTest.java | 8 +-
.../oak/commons/sort/StringSortTest.java | 7 +-
.../jackrabbit/oak/spi/mount/MountInfoTest.java | 15 ++-
.../jackrabbit/oak/core/SecureNodeBuilderTest.java | 13 +--
.../plugins/atomic/AtomicCounterEditorTest.java | 4 +-
.../oak/plugins/cow/COWNodeStoreTest.java | 4 +-
.../oak/plugins/index/AsyncIndexUpdateTest.java | 3 +-
.../oak/plugins/index/IndexUpdateTest.java | 8 +-
.../index/importer/IndexDefinitionUpdaterTest.java | 5 +-
.../index/nodetype/NodeTypeIndexQueryTest.java | 7 +-
.../index/property/MultiPropertyOrTest.java | 11 +-
.../index/property/MultipleIndicesTest.java | 19 ++--
.../OrderedPropertyIndexEditorProviderTest.java | 3 +-
.../plugins/index/property/RelativePathTest.java | 7 +-
.../property/SinglePropertyIndexQueryTests.java | 11 +-
.../property/ValuePatternPropertyIndexTests.java | 5 +-
.../strategy/ContentMirrorStoreStrategyTest.java | 14 +--
.../index/reference/ReferenceIndexTest.java | 9 +-
.../oak/plugins/nodetype/TypeEditorTest.java | 14 +--
.../nodetype/write/NodeTypeRegistryTest.java | 3 +-
.../oak/query/PropertyInexistenceTest.java | 22 ++--
.../oak/query/QueryCostOverheadTest.java | 13 +--
.../oak/query/SQL2OptimiseQueryTest.java | 15 ++-
.../oak/query/TraversalAvoidanceTest.java | 6 +-
.../oak/query/index/IndexSelectionTest.java | 10 +-
.../oak/query/index/TraversingIndexQueryTest.java | 114 ++++++++++-----------
.../oak/query/stats/QuerySimilarCostTest.java | 4 +-
.../AuthorizationConfigurationImplOSGiTest.java | 5 +-
.../authorization/AuthorizationContextTest.java | 5 +-
.../authorization/accesscontrol/ACLTest.java | 3 +-
.../AccessControlImporterAbortTest.java | 5 +-
.../AccessControlImporterBaseTest.java | 43 ++++----
.../AccessControlImporterBesteffortTest.java | 7 +-
.../AccessControlImporterIgnoreTest.java | 7 +-
.../AccessControlManagerImplTest.java | 19 ++--
...AccessControlManagerLimitedPermissionsTest.java | 7 +-
.../accesscontrol/AccessControlValidatorTest.java | 22 ++--
.../accesscontrol/RemappedPrivilegeNamesTest.java | 3 +-
.../composite/AbstractCompositeProviderTest.java | 19 ++--
.../CompositeAccessControlManagerTest.java | 4 +-
.../CompositePermissionProviderOrTest.java | 3 +-
.../composite/CompositeProviderCoverageTest.java | 7 +-
.../composite/CompositeProviderCustomMixTest.java | 4 +-
.../composite/CompositeProviderFullScopeTest.java | 4 +-
.../CompositeProviderGetTreePermissionTest.java | 5 +-
.../composite/CompositeProviderNoScopeTest.java | 7 +-
.../composite/CompositeProviderScopeTest.java | 3 +-
.../composite/CompositeProviderSupportedTest.java | 5 +-
.../evaluation/ChildOrderPropertyTest.java | 3 +-
.../authorization/evaluation/RootTest.java | 27 +++--
.../authorization/evaluation/TreeTest.java | 3 +-
.../permission/ChildOrderDiffTest.java | 5 +-
.../permission/PermissionValidatorTest.java | 4 +-
.../permission/VersionablePathHookTest.java | 4 +-
.../CompositeRestrictionProviderTest.java | 20 ++--
.../restriction/CurrentPatternTest.java | 7 +-
.../restriction/ItemNamePatternTest.java | 9 +-
.../restriction/ItemNameRestrictionTest.java | 13 ++-
.../restriction/NodeTypePatternTest.java | 5 +-
.../restriction/PrefixPatternTest.java | 5 +-
.../restriction/RestrictionProviderImplTest.java | 25 +++--
.../internal/SecurityProviderRegistrationTest.java | 5 +-
.../principal/PrincipalConfigurationImplTest.java | 5 +-
.../security/privilege/JcrAllCommitHookTest.java | 4 +-
.../security/privilege/PrivilegeContextTest.java | 6 +-
.../oak/security/privilege/PrivilegeImplTest.java | 6 +-
.../security/privilege/PrivilegeValidatorTest.java | 22 ++--
.../security/user/AbstractGroupPrincipalTest.java | 7 +-
.../user/AddMembersByIdBestEffortTest.java | 4 +-
.../security/user/AuthorizableIteratorTest.java | 5 +-
.../oak/security/user/GroupImplTest.java | 6 +-
.../oak/security/user/ImpersonationImplTest.java | 4 +-
.../oak/security/user/IntermediatePathTest.java | 5 +-
.../security/user/PasswordExpiryHistoryTest.java | 4 +-
.../oak/security/user/PasswordHistoryTest.java | 8 +-
.../oak/security/user/SystemUserImplTest.java | 4 +-
.../oak/security/user/UserContextTest.java | 5 +-
.../oak/security/user/UserImporterBaseTest.java | 5 +-
.../user/UserImporterImpersonationIgnoreTest.java | 18 ++--
.../user/UserImporterMembershipAbortTest.java | 9 +-
.../user/UserImporterMembershipBesteffortTest.java | 7 +-
.../user/UserImporterMembershipIgnoreTest.java | 29 +++---
.../oak/security/user/UserImporterTest.java | 16 +--
.../oak/security/user/action/GroupActionTest.java | 4 +-
.../user/action/PasswordValidationActionTest.java | 5 +-
.../oak/security/user/action/UserActionTest.java | 4 +-
.../oak/security/user/query/QueryUtilTest.java | 3 +-
.../security/user/query/ResultIteratorTest.java | 14 +--
.../security/user/query/UserQueryManagerTest.java | 5 +-
.../WhiteboardAuthorizableActionProviderTest.java | 3 +-
.../accesscontrol/L4_EffectivePoliciesTest.java | 3 +-
.../L5_AccessControlListImplTest.java | 19 ++--
.../L5_CustomPermissionEvaluationTest.java | 8 +-
.../privilege/L3_BuiltInPrivilegesTest.java | 4 +-
.../security/user/L6_AuthorizableContentTest.java | 5 +-
.../user/L7_AuthorizablePropertiesTest.java | 7 +-
.../org/apache/jackrabbit/oak/api/TreeTest.java | 4 +-
.../index/AsyncIndexUpdateClusterTestIT.java | 4 +-
.../jackrabbit/oak/IndexCostEvaluationTest.java | 3 +-
.../apache/jackrabbit/oak/jcr/NamePathTest.java | 26 +++--
.../security/authorization/HasPermissionTest.java | 5 +-
.../oak/jcr/security/user/RemappingTest.java | 5 +-
.../oak/jcr/security/user/UserQueryTest.java | 6 +-
.../apache/jackrabbit/oak/jcr/AtomicCounterIT.java | 6 +-
.../plugins/index/lucene/IndexNodeManagerTest.java | 9 +-
.../oak/plugins/index/lucene/IndexPlannerTest.java | 15 ++-
.../lucene/IndexlaneRepositoryTraversalTest.java | 5 +-
.../index/lucene/LuceneIndexDefinitionTest.java | 10 +-
.../index/lucene/LuceneIndexEditorTest.java | 4 +-
.../oak/plugins/index/lucene/LuceneIndexTest.java | 54 +++++-----
.../MultiplexingLucenePropertyIndexTest.java | 7 +-
.../index/lucene/NodeStateAnalyzerFactoryTest.java | 7 +-
.../index/lucene/hybrid/HybridIndexTest.java | 34 +++---
.../index/lucene/property/BucketSwitcherTest.java | 25 +++--
.../property/HybridPropertyIndexLookupTest.java | 11 +-
.../property/HybridPropertyIndexStorageTest.java | 5 +-
.../lucene/property/PropertyIndexCleanerTest.java | 5 +-
.../lucene/property/UniqueIndexCleanerTest.java | 8 +-
.../flatfile/ChildNodeStateProviderTest.java | 22 ++--
.../flatfile/NodeStateEntryWriterTest.java | 13 ++-
.../index/indexer/document/flatfile/TestUtils.java | 4 +-
.../oak/plugins/document/RevisionsCommandTest.java | 14 ++-
.../jackrabbit/oak/run/DataStoreCheckTest.java | 13 ++-
.../jackrabbit/oak/run/DataStoreCommandTest.java | 7 +-
.../oak/run/DocumentStoreCheckCommandTest.java | 4 +-
...ndTraversalQueriesSimilarResultsCommonTest.java | 5 +-
.../index/IndexExclusionQueryCommonTest.java | 13 ++-
.../oak/plugins/index/IndexPlannerCommonTest.java | 13 ++-
.../oak/plugins/index/search/AggregateTest.java | 42 ++++----
.../jackrabbit/oak/plugins/tree/TreeUtilTest.java | 88 ++++++++--------
.../spi/security/CompositeConfigurationTest.java | 11 +-
.../token/CompositeTokenProviderTest.java | 9 +-
.../authorization/accesscontrol/ACETest.java | 7 +-
.../AbstractAccessControlListTest.java | 3 +-
.../authorization/permission/PermissionsTest.java | 13 ++-
.../restriction/CompositePatternTest.java | 16 +--
.../CompositeRestrictionProviderTest.java | 7 +-
.../restriction/RestrictionImplTest.java | 5 +-
.../principal/CompositePrincipalProviderTest.java | 13 ++-
.../ImmutablePrivilegeDefinitionTest.java | 16 +--
.../privilege/PrivilegeBitsProviderTest.java | 28 ++---
.../user/action/AccessControlActionTest.java | 9 +-
.../user/action/CompositeActionProviderTest.java | 8 +-
.../spi/security/user/util/PasswordUtilTest.java | 5 +-
.../oak/spi/security/user/util/UserUtilTest.java | 9 +-
.../jackrabbit/oak/spi/xml/NodeInfoTest.java | 7 +-
.../jackrabbit/oak/spi/xml/PropInfoTest.java | 41 ++++----
.../oak/spi/xml/ReferenceChangeTrackerTest.java | 3 +-
.../oak/segment/SegmentDataStoreBlobGCIT.java | 4 +-
.../jackrabbit/oak/segment/SegmentParserTest.java | 5 +-
.../spi/monitor/CompositeIOMonitorTest.java | 11 +-
.../tool/iotrace/BreadthFirstTraceTest.java | 19 ++--
.../segment/tool/iotrace/DepthFirstTraceTest.java | 19 ++--
.../oak/segment/tool/iotrace/IOTracerTest.java | 3 +-
.../oak/segment/tool/iotrace/RandomTraceTest.java | 7 +-
.../oak/plugins/index/solr/query/SolrIndexIT.java | 28 ++---
.../composite/CompositeNodeStoreServiceTest.java | 5 +-
.../document/BlobReferenceIteratorTest.java | 5 +-
.../plugins/document/DocumentNodeStoreTest.java | 21 ++--
.../oak/plugins/document/DocumentSplitTest.java | 16 ++-
.../plugins/document/DocumentStoreStatsTest.java | 31 +++---
.../oak/plugins/document/FormatVersionTest.java | 4 +-
.../oak/plugins/document/MongoBlobGCTest.java | 6 +-
.../document/ThrottlingStatsCollectorImplTest.java | 34 +++---
.../document/VersionGarbageCollectorIT.java | 18 ++--
.../plugins/document/blob/RDBBlobStoreTest.java | 7 +-
.../bundlor/BundledDocumentDifferTest.java | 7 +-
.../document/bundlor/DocumentBundlingTest.java | 5 +-
.../secondary/SecondaryStoreCacheTest.java | 16 ++-
.../secondary/SecondaryStoreObserverTest.java | 10 +-
.../oak/plugins/document/util/BaseUpdaterTest.java | 5 +-
.../document/util/CreateMetricUpdaterTest.java | 17 +--
.../document/util/UpsertMetricUpdaterTest.java | 15 +--
.../oak/plugins/document/util/UtilsTest.java | 13 ++-
.../oak/plugins/memory/MemoryNodeBuilderTest.java | 4 +-
.../oak/upgrade/PrivilegeUpgradeTest.java | 5 +-
.../oak/upgrade/util/VersionCopyTestUtils.java | 3 +-
212 files changed, 1031 insertions(+), 1178 deletions(-)
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRefTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRefTest.java
index 9da36685a8..38e73d903b 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRefTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRefTest.java
@@ -17,11 +17,10 @@
package org.apache.jackrabbit.oak.spi.security.authentication.external;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Test;
@@ -169,7 +168,7 @@ public class ExternalIdentityRefTest {
@Test
public void testToString() {
- for (ExternalIdentityRef r : ImmutableList.of(ref, refEmptyProvider, refEmptyProvider)) {
+ for (ExternalIdentityRef r : List.of(ref, refEmptyProvider, refEmptyProvider)) {
assertEquals("ExternalIdentityRef{" + "id='" + r.getId() + '\'' + ", providerName='" + r.getProviderName() + '\'' + '}', r.toString());
}
}
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/TestIdentityProvider.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/TestIdentityProvider.java
index c2a8cbbb66..26278937c1 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/TestIdentityProvider.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/TestIdentityProvider.java
@@ -21,6 +21,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
@@ -29,8 +30,6 @@ import javax.jcr.Credentials;
import javax.jcr.SimpleCredentials;
import javax.security.auth.login.LoginException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.jetbrains.annotations.NotNull;
public class TestIdentityProvider implements ExternalIdentityProvider {
@@ -75,7 +74,7 @@ public class TestIdentityProvider implements ExternalIdentityProvider {
addUser(new TestUser(ID_SECOND_USER, getName())
.withProperty("profile/name", "Second User")
.withProperty("age", 24)
- .withProperty("col", ImmutableList.of("v1", "v2", "v3"))
+ .withProperty("col", List.of("v1", "v2", "v3"))
.withProperty("boolArr", new Boolean[]{true, false})
.withProperty("charArr", new char[]{'t', 'o', 'b'})
.withProperty("byteArr", new byte[0])
@@ -283,7 +282,7 @@ public class TestIdentityProvider implements ExternalIdentityProvider {
@NotNull
@Override
public Iterable<ExternalIdentityRef> getDeclaredMembers() {
- return ImmutableList.of();
+ return List.of();
}
}
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/basic/DefaultSyncContextTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/basic/DefaultSyncContextTest.java
index 32a607cbae..444d26698e 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/basic/DefaultSyncContextTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/basic/DefaultSyncContextTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.basic;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -1451,7 +1450,7 @@ public class DefaultSyncContextTest extends AbstractExternalAuthTest {
@Test
public void testCreateValuesEmptyCollection() throws Exception {
- Value[] vs = syncCtx.createValues(ImmutableList.of());
+ Value[] vs = syncCtx.createValues(List.of());
assertNotNull(vs);
assertEquals(0, vs.length);
}
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/AbstractDynamicTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/AbstractDynamicTest.java
index 4190916655..6094a9774e 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/AbstractDynamicTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/AbstractDynamicTest.java
@@ -16,12 +16,11 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
-import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser;
@@ -36,6 +35,7 @@ import javax.jcr.ValueFactory;
import java.security.Principal;
import java.util.Iterator;
import java.util.List;
+import java.util.stream.Collectors;
import static org.junit.Assert.assertSame;
@@ -116,17 +116,17 @@ public abstract class AbstractDynamicTest extends AbstractExternalAuthTest {
@NotNull
static List<String> getIds(@NotNull Iterator<? extends Authorizable> authorizables) {
- return ImmutableList.copyOf(Iterators.transform(authorizables, authorizable -> {
+ return CollectionUtils.toStream(authorizables).map(authorizable -> {
try {
return authorizable.getID();
} catch (RepositoryException repositoryException) {
throw new RuntimeException();
}
- }));
+ }).collect(Collectors.toList());
}
@NotNull
static List<String> getPrincipalNames(@NotNull Iterator<Principal> groupPrincipals) {
- return ImmutableList.copyOf(Iterators.transform(groupPrincipals, Principal::getName));
+ return CollectionUtils.toStream(groupPrincipals).map(Principal::getName).collect(Collectors.toList());
}
}
\ No newline at end of file
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/CustomCredentialsSupportTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/CustomCredentialsSupportTest.java
index 704f0c1a91..1ba7db49a5 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/CustomCredentialsSupportTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/CustomCredentialsSupportTest.java
@@ -27,7 +27,6 @@ import javax.jcr.GuestCredentials;
import javax.jcr.SimpleCredentials;
import javax.security.auth.login.LoginException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.AuthInfo;
import org.apache.jackrabbit.oak.api.ContentSession;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup;
@@ -71,7 +70,7 @@ public class CustomCredentialsSupportTest extends ExternalLoginTestBase {
@Test
public void testLoginWithUnsupportedCredentials() throws Exception {
- List<Credentials> creds = ImmutableList.of(
+ List<Credentials> creds = List.of(
new SimpleCredentials("testUser", new char[0]),
new GuestCredentials());
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicGroupsTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicGroupsTest.java
index a398d75482..a6e57907d3 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicGroupsTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicGroupsTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-import org.apache.jackrabbit.guava.common.collect.Iterators;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
import org.apache.jackrabbit.api.security.user.Authorizable;
@@ -26,6 +23,7 @@ import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityProvider;
@@ -294,7 +292,7 @@ public class DynamicGroupsTest extends DynamicSyncContextTest {
UserManager um = getUserManager(r);
PrincipalManager pm = getPrincipalManager(r);
- List<ExternalIdentityRef> declaredGroupRefs = ImmutableList.copyOf(previouslySyncedUser.getDeclaredGroups());
+ List<ExternalIdentityRef> declaredGroupRefs = CollectionUtils.toList(previouslySyncedUser.getDeclaredGroups());
assertTrue(declaredGroupRefs.size() > 1);
String groupId = declaredGroupRefs.get(0).getId();
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContextTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContextTest.java
index 40106a4399..6680d231bc 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContextTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContextTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Authorizable;
@@ -47,6 +46,7 @@ import org.junit.Test;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -119,7 +119,7 @@ public class DynamicSyncContextTest extends AbstractDynamicTest {
private void assertDynamicMembership(@NotNull Authorizable a, @NotNull ExternalIdentity externalIdentity, long depth) throws Exception {
Value[] vs = a.getProperty(REP_EXTERNAL_PRINCIPAL_NAMES);
- Set<String> pNames = ImmutableList.copyOf(vs).stream().map(value -> {
+ Set<String> pNames = Arrays.stream(vs).map(value -> {
try {
return value.getString();
} catch (RepositoryException e) {
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/DynamicGroupValidatorTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/DynamicGroupValidatorTest.java
index 130605c6f3..b780521f33 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/DynamicGroupValidatorTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/DynamicGroupValidatorTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.User;
@@ -141,7 +140,7 @@ public class DynamicGroupValidatorTest extends AbstractPrincipalTest {
assertFalse(groupTree.hasProperty(REP_MEMBERS));
String uuid = r.getTree(userManager.getAuthorizable(USER_ID).getPath()).getProperty(JCR_UUID).getValue(Type.STRING);
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(uuid), Type.WEAKREFERENCES);
+ groupTree.setProperty(REP_MEMBERS, List.of(uuid), Type.WEAKREFERENCES);
try {
r.commit();
fail("CommitFailedException 77 expected.");
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProviderTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProviderTest.java
index 98c7e6aec4..f31f01b097 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProviderTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProviderTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
@@ -586,7 +585,7 @@ public class ExternalGroupPrincipalProviderTest extends AbstractPrincipalTest {
return in.iterator();
}
};
- List<Principal> out = ImmutableList.copyOf(p.findPrincipals(null, false, PrincipalManager.SEARCH_TYPE_ALL, 0, -1));
+ List<Principal> out = CollectionUtils.toList(p.findPrincipals(null, false, PrincipalManager.SEARCH_TYPE_ALL, 0, -1));
Collections.sort(in, Comparator.comparing(Principal::getName));
assertEquals(in, out);
}
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalTest.java
index 78e5bb6ac6..69cb1f25a5 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
@@ -26,6 +25,7 @@ import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.oak.api.QueryEngine;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef;
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser;
@@ -38,7 +38,9 @@ import javax.jcr.RepositoryException;
import java.security.Principal;
import java.text.ParseException;
import java.util.Enumeration;
+import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static org.apache.jackrabbit.oak.spi.security.authentication.external.TestIdentityProvider.ID_SECOND_USER;
import static org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES;
@@ -69,10 +71,10 @@ public class ExternalGroupPrincipalTest extends AbstractPrincipalTest {
Authorizable notMember = getUserManager(root).getAuthorizable(ID_SECOND_USER);
assertFalse(principal.isMember(notMember.getPrincipal()));
- root.getTree(notMember.getPath()).setProperty(REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of("secondGroup"), Type.STRINGS);
+ root.getTree(notMember.getPath()).setProperty(REP_EXTERNAL_PRINCIPAL_NAMES, List.of("secondGroup"), Type.STRINGS);
assertFalse(principal.isMember(notMember.getPrincipal()));
- root.getTree(notMember.getPath()).setProperty(REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of(), Type.STRINGS);
+ root.getTree(notMember.getPath()).setProperty(REP_EXTERNAL_PRINCIPAL_NAMES, List.of(), Type.STRINGS);
assertFalse(principal.isMember(new PrincipalImpl(notMember.getPrincipal().getName())));
}
@@ -80,7 +82,8 @@ public class ExternalGroupPrincipalTest extends AbstractPrincipalTest {
public void testIsMemberExternalGroup() throws Exception {
GroupPrincipal principal = getGroupPrincipal();
- Iterable<String> exGroupPrincNames = Iterables.transform(ImmutableList.copyOf(idp.listGroups()), ExternalIdentity::getPrincipalName);
+ List<String> exGroupPrincNames = CollectionUtils.toStream(
+ idp.listGroups()).map(ExternalIdentity::getPrincipalName).collect(Collectors.toList());
for (String principalName : exGroupPrincNames) {
assertFalse(principal.isMember(new PrincipalImpl(principalName)));
}
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalIdentityValidatorTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalIdentityValidatorTest.java
index 52963b0370..b45b21062b 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalIdentityValidatorTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalIdentityValidatorTest.java
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.prin
import javax.jcr.SimpleCredentials;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -85,7 +84,7 @@ public class ExternalIdentityValidatorTest extends ExternalLoginTestBase {
public void testAddExternalPrincipalNames() throws Exception {
Tree userTree = root.getTree(testUserPath);
try {
- userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of("principalName"), Type.STRINGS);
+ userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, List.of("principalName"), Type.STRINGS);
root.commit();
fail("Creating rep:externalPrincipalNames must be detected.");
} catch (CommitFailedException e) {
@@ -101,7 +100,7 @@ public class ExternalIdentityValidatorTest extends ExternalLoginTestBase {
Root systemRoot = getSystemRoot();
try {
Tree userTree = systemRoot.getTree(testUserPath);
- userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of("principalName"), Type.STRINGS);
+ userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, List.of("principalName"), Type.STRINGS);
systemRoot.commit();
fail("Creating rep:externalPrincipalNames without rep:externalId must be detected.");
} catch (CommitFailedException e) {
@@ -117,7 +116,7 @@ public class ExternalIdentityValidatorTest extends ExternalLoginTestBase {
Root systemRoot = getSystemRoot();
Tree userTree = systemRoot.getTree(testUserPath);
userTree.setProperty(REP_EXTERNAL_ID, "externalId");
- userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of("principalName"), Type.STRINGS);
+ userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, List.of("principalName"), Type.STRINGS);
systemRoot.commit();
}
@@ -167,7 +166,7 @@ public class ExternalIdentityValidatorTest extends ExternalLoginTestBase {
Tree userTree = systemRoot.getTree(externalUserPath);
// changing with system root must succeed
- userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of("principalNames"), Type.STRINGS);
+ userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, List.of("principalNames"), Type.STRINGS);
systemRoot.commit();
}
@@ -233,7 +232,7 @@ public class ExternalIdentityValidatorTest extends ExternalLoginTestBase {
Root systemRoot = getSystemRoot();
try {
Tree userTree = systemRoot.getTree(testUserPath);
- userTree.setProperty(REP_EXTERNAL_ID, ImmutableList.of("id", "id2"), Type.STRINGS);
+ userTree.setProperty(REP_EXTERNAL_ID, List.of("id", "id2"), Type.STRINGS);
systemRoot.commit();
fail("Creating rep:externalId as multiple STRING property must be detected.");
} catch (CommitFailedException e) {
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/PrincipalProviderAutoMembershipTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/PrincipalProviderAutoMembershipTest.java
index 7d68a2ceb4..1afb4307a7 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/PrincipalProviderAutoMembershipTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/PrincipalProviderAutoMembershipTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
@@ -300,7 +299,7 @@ public class PrincipalProviderAutoMembershipTest extends ExternalGroupPrincipalP
@Test
public void testFindPrincipalsByHint() throws Exception {
- List<String> hints = ImmutableList.of(
+ List<String> hints = List.of(
USER_AUTO_MEMBERSHIP_GROUP_PRINCIPAL_NAME,
GROUP_AUTO_MEMBERSHIP_GROUP_PRINCIPAL_NAME,
USER_AUTO_MEMBERSHIP_GROUP_ID,
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNoProtectionTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNoProtectionTest.java
index 0c894a3551..8866700c55 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNoProtectionTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNoProtectionTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;
+import java.util.List;
import java.util.Map;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
@@ -41,7 +41,7 @@ public class ValidatorNoProtectionTest extends ExternalIdentityValidatorTest {
public void testRepExternalIdMultiple() throws Exception {
Root systemRoot = getSystemRoot();
Tree userTree = systemRoot.getTree(testUserPath);
- userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_ID, ImmutableList.of("id", "id2"), Type.STRINGS);
+ userTree.setProperty(ExternalIdentityConstants.REP_EXTERNAL_ID, List.of("id", "id2"), Type.STRINGS);
systemRoot.commit();
}
diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNotDynamicTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNotDynamicTest.java
index a6a9ab2d36..f63aef6450 100644
--- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNotDynamicTest.java
+++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ValidatorNotDynamicTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Tree;
@@ -24,6 +23,8 @@ import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalIdentityConstants;
import org.junit.Test;
+import java.util.List;
+
import static org.apache.jackrabbit.oak.api.CommitFailedException.CONSTRAINT;
import static org.junit.Assert.fail;
@@ -41,7 +42,7 @@ public class ValidatorNotDynamicTest extends ExternalIdentityValidatorTest {
private void setExternalPrincipalNames() throws Exception {
Root systemRoot = getSystemRoot();
- systemRoot.getTree(externalUserPath).setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, ImmutableList.of("principalName"), Type.STRINGS);
+ systemRoot.getTree(externalUserPath).setProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES, List.of("principalName"), Type.STRINGS);
systemRoot.commit();
root.refresh();
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/AccessControlTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/AccessControlTest.java
index b157e1b404..bef75f9deb 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/AccessControlTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/AccessControlTest.java
@@ -21,7 +21,6 @@ import java.util.Set;
import javax.jcr.security.AccessControlManager;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
@@ -73,7 +72,7 @@ public class AccessControlTest extends AbstractCugTest {
* - /content2 : allow everyone, deny testGroup (isolated)
*
*/
- acPaths = ImmutableList.of(
+ acPaths = List.of(
"/content/rep:policy",
PermissionConstants.PERMISSIONS_STORE_PATH,
"/content/a/rep:cugPolicy",
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugAccessControlManagerTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugAccessControlManagerTest.java
index cdc445031c..3cfed4f116 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugAccessControlManagerTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugAccessControlManagerTest.java
@@ -30,7 +30,6 @@ import javax.jcr.security.AccessControlPolicyIterator;
import javax.jcr.security.NamedAccessControlPolicy;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.guava.common.collect.Sets;
import org.apache.jackrabbit.JcrConstants;
@@ -170,7 +169,7 @@ public class CugAccessControlManagerTest extends AbstractCugTest {
CugPolicy cugPolicy = (CugPolicy) policies[0];
assertTrue(cugPolicy.getPrincipals().isEmpty());
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of("unknownPrincipalName", EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of("unknownPrincipalName", EveryonePrincipal.NAME), Type.STRINGS);
policies = cugAccessControlManager.getPolicies(SUPPORTED_PATH);
cugPolicy = (CugPolicy) policies[0];
@@ -323,7 +322,7 @@ public class CugAccessControlManagerTest extends AbstractCugTest {
@Test
public void testSetInvalidPolicy() throws Exception {
- List<AccessControlPolicy> invalidPolicies = ImmutableList.of(
+ List<AccessControlPolicy> invalidPolicies = List.of(
new AccessControlPolicy() {},
(NamedAccessControlPolicy) () -> "name",
InvalidCug.INSTANCE
@@ -453,7 +452,7 @@ public class CugAccessControlManagerTest extends AbstractCugTest {
@Test
public void testRemoveInvalidPolicy() throws Exception {
- List<AccessControlPolicy> invalidPolicies = ImmutableList.of(
+ List<AccessControlPolicy> invalidPolicies = List.of(
new AccessControlPolicy() {},
(NamedAccessControlPolicy) () -> "name",
InvalidCug.INSTANCE
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugConfigurationTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugConfigurationTest.java
index 8f92428a20..e50152e7ec 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugConfigurationTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugConfigurationTest.java
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.Set;
import javax.jcr.security.AccessControlManager;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
import org.apache.jackrabbit.oak.security.authorization.composite.CompositeAuthorizationConfiguration;
@@ -186,7 +185,7 @@ public class CugConfigurationTest extends AbstractCugTest {
CugConstants.PARAM_CUG_SUPPORTED_PATHS, "/content");
CugConfiguration cc = createConfiguration(params);
- List<Principal> excluded = ImmutableList.of(
+ List<Principal> excluded = List.of(
SystemPrincipal.INSTANCE,
(AdminPrincipal) () -> "admin",
(SystemUserPrincipal) () -> "systemUser");
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugContextTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugContextTest.java
index 63c323b78e..5508bde012 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugContextTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugContextTest.java
@@ -21,7 +21,6 @@ import java.util.Set;
import javax.jcr.security.AccessControlList;
import javax.jcr.security.AccessControlManager;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -41,7 +40,7 @@ import static org.junit.Assert.assertTrue;
public class CugContextTest extends AbstractCugTest implements NodeTypeConstants {
private static String CUG_PATH = "/content/a/rep:cugPolicy";
- private static List<String> NO_CUG_PATH = ImmutableList.of(
+ private static List<String> NO_CUG_PATH = List.of(
"/content",
"/content/a",
"/content/rep:policy",
@@ -116,7 +115,7 @@ public class CugContextTest extends AbstractCugTest implements NodeTypeConstants
assertTrue(CugContext.INSTANCE.definesLocation(TreeLocation.create(root, CUG_PATH)));
assertTrue(CugContext.INSTANCE.definesLocation(TreeLocation.create(root, CUG_PATH + "/" + CugConstants.REP_PRINCIPAL_NAMES)));
- List<String> existingNoCug = ImmutableList.of(
+ List<String> existingNoCug = List.of(
"/content",
"/content/a",
"/content/rep:policy"
@@ -126,7 +125,7 @@ public class CugContextTest extends AbstractCugTest implements NodeTypeConstants
assertFalse(path, CugContext.INSTANCE.definesLocation(TreeLocation.create(root, path + "/" + CugConstants.REP_PRINCIPAL_NAMES)));
}
- List<String> nonExistingCug = ImmutableList.of(
+ List<String> nonExistingCug = List.of(
"/content/rep:cugPolicy",
UNSUPPORTED_PATH + "/rep:cugPolicy");
for (String path : nonExistingCug) {
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugEvaluationTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugEvaluationTest.java
index e9c7b20521..e9c2835dfe 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugEvaluationTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugEvaluationTest.java
@@ -22,7 +22,6 @@ import java.util.Set;
import javax.jcr.security.AccessControlList;
import javax.jcr.security.AccessControlManager;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.ContentSession;
@@ -104,7 +103,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
@Test
public void testRead() {
- List<String> noAccess = ImmutableList.of(
+ List<String> noAccess = List.of(
"/", UNSUPPORTED_PATH, /* no access */
"/content/a", "/content/a/b", "/content/aa/bb", /* granted by ace, denied by cug */
"/content2" /* granted by cug only */
@@ -113,7 +112,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
assertFalse(p, testRoot.getTree(p).exists());
}
- List<String> readAccess = ImmutableList.of("/content", "/content/subtree", "/content/a/b/c", "/content/aa");
+ List<String> readAccess = List.of("/content", "/content/subtree", "/content/a/b/c", "/content/aa");
for (String p : readAccess) {
assertTrue(p, testRoot.getTree(p).exists());
}
@@ -135,7 +134,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
@Test
public void testReadCug() {
- List<String> noAccess = ImmutableList.of(
+ List<String> noAccess = List.of(
"/content/a/rep:cugPolicy", "/content/aa/bb/rep:cugPolicy", "/content2/rep:cugPolicy"
);
for (String p : noAccess) {
@@ -155,7 +154,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
@Test
public void testWrite() throws Exception {
- List<String> readOnly = ImmutableList.of("/content", "/content/a/b/c");
+ List<String> readOnly = List.of("/content", "/content/a/b/c");
for (String p : readOnly) {
try {
Tree content = testRoot.getTree(p);
@@ -179,7 +178,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
assertTrue(pp.isGranted(root.getTree("/content/writeTest"), null, Permissions.ADD_NODE));
assertTrue(pp.isGranted(root.getTree("/content/a/b/c/writeTest"), null, Permissions.ADD_NODE));
- List<String> paths = ImmutableList.of("/content", "/content/a/b/c");
+ List<String> paths = List.of("/content", "/content/a/b/c");
for (String p : paths) {
Tree content = r.getTree(p);
TreeUtil.addChild(content, "writeTest", NT_OAK_UNSTRUCTURED);
@@ -197,7 +196,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
Root r = cs.getLatestRoot();
try {
Tree tree = r.getTree("/content/a/b/c");
- tree.setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REP_CUG_MIXIN, AccessControlConstants.MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
+ tree.setProperty(JCR_MIXINTYPES, List.of(MIX_REP_CUG_MIXIN, AccessControlConstants.MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
tree.addChild(AccessControlConstants.REP_POLICY).setProperty(JCR_PRIMARYTYPE, AccessControlConstants.NT_REP_ACL, Type.NAME);
r.commit();
fail();
@@ -215,7 +214,7 @@ public class CugEvaluationTest extends AbstractCugTest implements NodeTypeConsta
try {
// modify the existing cug
Tree tree = r.getTree("/content/a/rep:cugPolicy");
- tree.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME, testGroupPrincipal.getName()), Type.STRINGS);
+ tree.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME, testGroupPrincipal.getName()), Type.STRINGS);
r.commit();
fail();
} catch (CommitFailedException e) {
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugPermissionProviderTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugPermissionProviderTest.java
index be0551a2f9..9d26e422a2 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugPermissionProviderTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugPermissionProviderTest.java
@@ -25,7 +25,6 @@ import javax.jcr.AccessDeniedException;
import javax.jcr.GuestCredentials;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.ContentSession;
import org.apache.jackrabbit.oak.api.Root;
@@ -88,11 +87,11 @@ public class CugPermissionProviderTest extends AbstractCugTest implements NodeTy
PATH_INCUG_MAP.put(INVALID_PATH, false);
}
- private static final List<String> READABLE_PATHS = ImmutableList.of(
+ private static final List<String> READABLE_PATHS = List.of(
"/content/a/b/c", "/content/a/b/c/jcr:primaryType",
"/content/a/b/c/nonExisting", "/content/a/b/c/nonExisting/jcr:primaryType");
- private static final List<String> NOT_READABLE_PATHS = ImmutableList.of(
+ private static final List<String> NOT_READABLE_PATHS = List.of(
"/", "/jcr:primaryType",
UNSUPPORTED_PATH, UNSUPPORTED_PATH + "/jcr:primaryType",
"/content", "/content/jcr:primaryType",
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugValidatorTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugValidatorTest.java
index 1831b7921d..b5036c057f 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugValidatorTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugValidatorTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.cug.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -37,6 +36,8 @@ import org.junit.Test;
import javax.jcr.nodetype.NodeDefinitionTemplate;
import javax.jcr.nodetype.NodeTypeTemplate;
+import java.util.List;
+
import static java.util.Objects.requireNonNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -64,7 +65,7 @@ public class CugValidatorTest extends AbstractCugTest {
node = root.getTree(SUPPORTED_PATH2);
try {
node.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_CUG_POLICY, Type.NAME);
- node.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ node.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
root.commit();
fail();
} catch (CommitFailedException e) {
@@ -118,9 +119,9 @@ public class CugValidatorTest extends AbstractCugTest {
@Test(expected = CommitFailedException.class)
public void testChangePrimaryTypeOfCug() throws Exception {
- node.setProperty(JcrConstants.JCR_MIXINTYPES, ImmutableList.of(MIX_REP_CUG_MIXIN), Type.NAMES);
+ node.setProperty(JcrConstants.JCR_MIXINTYPES, List.of(MIX_REP_CUG_MIXIN), Type.NAMES);
Tree cug = TreeUtil.addChild(node, REP_CUG_POLICY, NT_REP_CUG_POLICY);
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
root.commit();
try {
@@ -136,7 +137,7 @@ public class CugValidatorTest extends AbstractCugTest {
@Test(expected = CommitFailedException.class)
public void testInvalidPrimaryType() throws Exception {
Tree cug = TreeUtil.addChild(node, REP_CUG_POLICY, NodeTypeConstants.NT_OAK_UNSTRUCTURED);
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
try {
root.commit();
@@ -152,7 +153,7 @@ public class CugValidatorTest extends AbstractCugTest {
@Test(expected = CommitFailedException.class)
public void testMissingMixin() throws Exception {
Tree cug = TreeUtil.addChild(node, REP_CUG_POLICY, NT_REP_CUG_POLICY);
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
try {
root.commit();
@@ -167,9 +168,9 @@ public class CugValidatorTest extends AbstractCugTest {
@Test(expected = CommitFailedException.class)
public void testRemoveMixin() throws Exception {
- node.setProperty(JcrConstants.JCR_MIXINTYPES, ImmutableList.of(MIX_REP_CUG_MIXIN), Type.NAMES);
+ node.setProperty(JcrConstants.JCR_MIXINTYPES, List.of(MIX_REP_CUG_MIXIN), Type.NAMES);
Tree cug = TreeUtil.addChild(node, REP_CUG_POLICY, NT_REP_CUG_POLICY);
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
root.commit();
try {
@@ -186,9 +187,9 @@ public class CugValidatorTest extends AbstractCugTest {
@Test(expected = CommitFailedException.class)
public void testCugPolicyWithDifferentName() throws Exception {
- node.setProperty(JcrConstants.JCR_MIXINTYPES, ImmutableList.of(MIX_REP_CUG_MIXIN), Type.NAMES);
+ node.setProperty(JcrConstants.JCR_MIXINTYPES, List.of(MIX_REP_CUG_MIXIN), Type.NAMES);
Tree cug = TreeUtil.addChild(node, "anotherName", NT_REP_CUG_POLICY);
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
try {
root.commit();
} catch (CommitFailedException e) {
@@ -228,7 +229,7 @@ public class CugValidatorTest extends AbstractCugTest {
public void testJcrNodeTypesOutsideOfSystemIsValidated() throws Exception {
Tree n = TreeUtil.addChild(node, JCR_NODE_TYPES, NT_OAK_UNSTRUCTURED);
Tree cug = TreeUtil.addChild(n, REP_CUG_POLICY, NT_REP_CUG_POLICY);
- cug.setProperty(REP_PRINCIPAL_NAMES, ImmutableList.of(EveryonePrincipal.NAME), Type.STRINGS);
+ cug.setProperty(REP_PRINCIPAL_NAMES, List.of(EveryonePrincipal.NAME), Type.STRINGS);
try {
root.commit();
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NestedCugHookTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NestedCugHookTest.java
index 462fef159e..e5a8fef4bb 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NestedCugHookTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NestedCugHookTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.cug.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
@@ -36,6 +35,7 @@ import org.junit.Test;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.AccessControlPolicy;
import java.util.Collections;
+import java.util.List;
import static org.apache.jackrabbit.oak.commons.PathUtils.ROOT_PATH;
import static org.junit.Assert.assertEquals;
@@ -421,7 +421,7 @@ public class NestedCugHookTest extends AbstractCugTest {
// cannot be relativized during the reconnect-preparation
NodeBuilder before = new MemoryNodeBuilder(getTreeProvider().asNodeState(adminSession.getLatestRoot().getTree(PathUtils.ROOT_PATH)));
NodeBuilder cugNode = before.getChildNode("content").getChildNode("rep:cugPolicy");
- cugNode.setProperty(HIDDEN_NESTED_CUGS, ImmutableList.of("/nested/out/of/hierarchy", "/content/subtree"), Type.STRINGS);
+ cugNode.setProperty(HIDDEN_NESTED_CUGS, List.of("/nested/out/of/hierarchy", "/content/subtree"), Type.STRINGS);
NestedCugHook nch = new NestedCugHook();
nch.processCommit(before.getNodeState(), after, new CommitInfo("sid", null));
@@ -442,7 +442,7 @@ public class NestedCugHookTest extends AbstractCugTest {
// for that very cug)
NodeBuilder after = new MemoryNodeBuilder(getTreeProvider().asNodeState(root.getTree(PathUtils.ROOT_PATH)));
NodeBuilder cugNode = after.getChildNode("content").getChildNode("rep:cugPolicy");
- cugNode.setProperty(HIDDEN_NESTED_CUGS, ImmutableList.of(), Type.STRINGS);
+ cugNode.setProperty(HIDDEN_NESTED_CUGS, List.of(), Type.STRINGS);
NodeState before = getTreeProvider().asNodeState(adminSession.getLatestRoot().getTree(PathUtils.ROOT_PATH));
@@ -467,7 +467,7 @@ public class NestedCugHookTest extends AbstractCugTest {
// the nested cug of the before-state (and thus cannot clean-up the hidden structure)
NodeBuilder before = new MemoryNodeBuilder(getTreeProvider().asNodeState(adminSession.getLatestRoot().getTree(PathUtils.ROOT_PATH)));
NodeBuilder cugNode = before.getChildNode("content").getChildNode("rep:cugPolicy");
- cugNode.setProperty(HIDDEN_NESTED_CUGS, ImmutableList.of(), Type.STRINGS);
+ cugNode.setProperty(HIDDEN_NESTED_CUGS, List.of(), Type.STRINGS);
NestedCugHook nch = new NestedCugHook();
nch.processCommit(before.getNodeState(), after, new CommitInfo("sid", null));
@@ -510,7 +510,7 @@ public class NestedCugHookTest extends AbstractCugTest {
// the nested /content with the root node (and thus cannot clean-up the hidden structure,
// which is already 'cleaned' for that very cug)
NodeBuilder after = new MemoryNodeBuilder(getTreeProvider().asNodeState(root.getTree(PathUtils.ROOT_PATH)));
- after.setProperty(HIDDEN_NESTED_CUGS, ImmutableList.of(), Type.STRINGS);
+ after.setProperty(HIDDEN_NESTED_CUGS, List.of(), Type.STRINGS);
after.setProperty(HIDDEN_TOP_CUG_CNT, 0);
NodeState before = getTreeProvider().asNodeState(adminSession.getLatestRoot().getTree(PathUtils.ROOT_PATH));
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NoCugTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NoCugTest.java
index c0f0ca0776..586aa8e5d3 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NoCugTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/NoCugTest.java
@@ -21,7 +21,6 @@ import java.util.Set;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.plugins.tree.TreeLocation;
@@ -40,7 +39,7 @@ import static org.junit.Assert.assertTrue;
public class NoCugTest extends AbstractCugTest {
- private static final List<String> PATHS = ImmutableList.of(PathUtils.ROOT_PATH, SUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH3, UNSUPPORTED_PATH, INVALID_PATH);
+ private static final List<String> PATHS = List.of(PathUtils.ROOT_PATH, SUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH3, UNSUPPORTED_PATH, INVALID_PATH);
private CugPermissionProvider cugPermProvider;
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/SupportedPathsTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/SupportedPathsTest.java
index 31ed92b7bf..dad9f29bc6 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/SupportedPathsTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/SupportedPathsTest.java
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -79,7 +78,7 @@ public class SupportedPathsTest {
public void testRootPath() {
SupportedPaths supportedPaths = new SupportedPaths(Set.of("/"));
- List<String> paths = ImmutableList.of("/", "/content", "/jcr:system", "/testRoot", "/some/other/path", "/content/a", "/content/a/b");
+ List<String> paths = List.of("/", "/content", "/jcr:system", "/testRoot", "/some/other/path", "/content/a", "/content/a/b");
for (String path : paths) {
assertTrue(path, supportedPaths.includes(path));
@@ -91,7 +90,7 @@ public class SupportedPathsTest {
public void testEmpty() {
SupportedPaths supportedPaths = new SupportedPaths(Set.of());
- List<String> paths = ImmutableList.of("/", "/content", "/jcr:system", "/testRoot", "/some/other/path", "/content/a", "/content/a/b");
+ List<String> paths = List.of("/", "/content", "/jcr:system", "/testRoot", "/some/other/path", "/content/a", "/content/a/b");
for (String path : paths) {
assertFalse(path, supportedPaths.includes(path));
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/TopLevelPathTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/TopLevelPathTest.java
index d3f534d4ef..caf119c3f6 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/TopLevelPathTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/TopLevelPathTest.java
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.spi.security.authorization.cug.impl;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -39,7 +38,7 @@ import static org.junit.Assert.assertTrue;
public class TopLevelPathTest extends AbstractCugTest {
- private static final List<String> PATHS = ImmutableList.of(ROOT_PATH, SUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH3, UNSUPPORTED_PATH, INVALID_PATH);
+ private static final List<String> PATHS = List.of(ROOT_PATH, SUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH3, UNSUPPORTED_PATH, INVALID_PATH);
@Test
public void testHasAnyNoCug() {
diff --git a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/VersionTest.java b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/VersionTest.java
index 5ae6789678..0a90e55253 100644
--- a/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/VersionTest.java
+++ b/oak-authorization-cug/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/VersionTest.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.ContentSession;
@@ -76,12 +75,12 @@ public class VersionTest extends AbstractCugTest implements NodeTypeConstants, V
// - /content2 : allow everyone, deny testGroup (isolated)
setupCugsAndAcls();
- readAccess = ImmutableList.of(
+ readAccess = List.of(
SUPPORTED_PATH,
"/content/subtree",
"/content/aa");
- noReadAccess = ImmutableList.of(
+ noReadAccess = List.of(
UNSUPPORTED_PATH, /* no access */
"/content2", /* granted by cug only */
"/content/a", /* granted by ace, denied by cug */
diff --git a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/AccessControlManagerLimitedUserTest.java b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/AccessControlManagerLimitedUserTest.java
index 642a6812ce..ccb3d1977a 100644
--- a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/AccessControlManagerLimitedUserTest.java
+++ b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/AccessControlManagerLimitedUserTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy;
@@ -47,7 +46,6 @@ import javax.jcr.security.AccessControlPolicy;
import javax.jcr.security.Privilege;
import java.security.Principal;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -561,7 +559,7 @@ public class AccessControlManagerLimitedUserTest extends AbstractPrincipalBasedT
Tree policyTree = testRoot.getTree(getPolicyPath());
Tree entry = TreeUtil.addChild(policyTree, "entry", NT_REP_PRINCIPAL_ENTRY);
entry.setProperty(REP_EFFECTIVE_PATH, TEST_OAK_PATH, Type.PATH);
- entry.setProperty(Constants.REP_PRIVILEGES, ImmutableList.of(JCR_ADD_CHILD_NODES), Type.NAMES);
+ entry.setProperty(Constants.REP_PRIVILEGES, List.of(JCR_ADD_CHILD_NODES), Type.NAMES);
testRoot.commit();
} catch (CommitFailedException e) {
assertEquals(CommitFailedException.ACCESS, e.getType());
@@ -581,7 +579,7 @@ public class AccessControlManagerLimitedUserTest extends AbstractPrincipalBasedT
Tree policyTree = testRoot.getTree(getPolicyPath());
Tree entry = TreeUtil.addChild(policyTree, "entry", NT_REP_PRINCIPAL_ENTRY);
entry.setProperty(REP_EFFECTIVE_PATH, TEST_OAK_PATH, Type.PATH);
- entry.setProperty(Constants.REP_PRIVILEGES, ImmutableList.of(JCR_ADD_CHILD_NODES), Type.NAMES);
+ entry.setProperty(Constants.REP_PRIVILEGES, List.of(JCR_ADD_CHILD_NODES), Type.NAMES);
testRoot.commit();
} catch (CommitFailedException e) {
assertEquals(CommitFailedException.ACCESS, e.getType());
@@ -612,7 +610,7 @@ public class AccessControlManagerLimitedUserTest extends AbstractPrincipalBasedT
Tree policyTree = testRoot.getTree(getPolicyPath());
Tree entry = TreeUtil.addChild(policyTree, "entry", NT_REP_PRINCIPAL_ENTRY);
entry.setProperty(REP_EFFECTIVE_PATH, TEST_OAK_PATH, Type.PATH);
- entry.setProperty(Constants.REP_PRIVILEGES, ImmutableList.of(JCR_ADD_CHILD_NODES), Type.NAMES);
+ entry.setProperty(Constants.REP_PRIVILEGES, List.of(JCR_ADD_CHILD_NODES), Type.NAMES);
testRoot.commit();
}
diff --git a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/MockUtility.java b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/MockUtility.java
index 6d87333b09..ad7e90f0e1 100644
--- a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/MockUtility.java
+++ b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/MockUtility.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Root;
@@ -36,6 +35,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.mockito.Mockito;
+import java.util.Arrays;
import java.util.Set;
import static org.mockito.ArgumentMatchers.any;
@@ -98,7 +98,7 @@ final class MockUtility {
}
static PropertyState createMixinTypesProperty(@NotNull String... mixinTypes) {
- return PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, ImmutableList.copyOf(mixinTypes), Type.NAMES);
+ return PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, Arrays.asList(mixinTypes), Type.NAMES);
}
static FilterProvider mockFilterProvider(boolean canHandle) {
diff --git a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PolicyValidatorTest.java b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PolicyValidatorTest.java
index 2205f984f7..66b46e64e0 100644
--- a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PolicyValidatorTest.java
+++ b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PolicyValidatorTest.java
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
@@ -42,6 +40,7 @@ import org.junit.Test;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -525,7 +524,7 @@ public class PolicyValidatorTest extends AbstractPrincipalBasedTest {
try {
NodeState entry = mockNodeState(NT_REP_PRINCIPAL_ENTRY);
when(entry.getProperty(REP_EFFECTIVE_PATH)).thenReturn(PropertyStates.createProperty(REP_EFFECTIVE_PATH,"/path", Type.PATH));
- when(entry.getNames(REP_PRIVILEGES)).thenReturn(ImmutableList.of("privName"));
+ when(entry.getNames(REP_PRIVILEGES)).thenReturn(List.of("privName"));
v.childNodeChanged("entryName", entry, entry);
fail("CommitFailedException type OAK code 13 expected.");
@@ -554,7 +553,7 @@ public class PolicyValidatorTest extends AbstractPrincipalBasedTest {
try {
NodeState entry = mockNodeState(NT_REP_PRINCIPAL_ENTRY);
when(entry.getProperty(REP_EFFECTIVE_PATH)).thenReturn(null);
- when(entry.getNames(REP_PRIVILEGES)).thenReturn(ImmutableList.of(JCR_READ));
+ when(entry.getNames(REP_PRIVILEGES)).thenReturn(List.of(JCR_READ));
v.childNodeChanged("entryName", entry, entry);
fail("CommitFailedException type CONSTRAINT code 21 expected.");
diff --git a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManagerTest.java b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManagerTest.java
index c5a54cbf0f..42d65a0499 100644
--- a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManagerTest.java
+++ b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManagerTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy;
import org.apache.jackrabbit.api.security.authorization.PrincipalAccessControlList;
@@ -24,6 +23,7 @@ import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
import org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants;
import org.apache.jackrabbit.oak.spi.security.authorization.AuthorizationConfiguration;
@@ -554,7 +554,7 @@ public class PrincipalBasedAccessControlManagerTest extends AbstractPrincipalBas
Iterator<AccessControlPolicy> effective = acMgr.getEffectivePolicies(principals, new String[0]);
AccessControlPolicy[] expected = acMgr.getEffectivePolicies(principals);
- assertArrayEquals(expected, ImmutableList.copyOf(effective).toArray(new AccessControlPolicy[0]));
+ assertArrayEquals(expected, (CollectionUtils.toList(effective).toArray()));
}
@Test
@@ -567,7 +567,7 @@ public class PrincipalBasedAccessControlManagerTest extends AbstractPrincipalBas
String[] paths = readablePaths.stream().map(oakPath -> namePathMapper.getJcrPath(oakPath)).distinct().toArray(String[]::new);
assertEquals(3, paths.length);
- List<AccessControlPolicy> effective = ImmutableList.copyOf(acMgr.getEffectivePolicies(Collections.singleton(validPrincipal), paths));
+ List<AccessControlPolicy> effective = CollectionUtils.toList(acMgr.getEffectivePolicies(Collections.singleton(validPrincipal), paths));
assertEquals(1, effective.size());
assertEquals(ReadPolicy.INSTANCE, effective.get(0));
diff --git a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImplTest.java b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImplTest.java
index f27ed5f556..c8f5bd7bd9 100644
--- a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImplTest.java
+++ b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImplTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.authorization.PrincipalAccessControlList;
import org.apache.jackrabbit.api.security.authorization.PrivilegeCollection;
@@ -50,6 +49,7 @@ import javax.jcr.security.AccessControlEntry;
import javax.jcr.security.AccessControlException;
import javax.jcr.security.Privilege;
import java.security.Principal;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -140,7 +140,7 @@ public class PrincipalPolicyImplTest extends AbstractPrincipalBasedTest {
Tree t = mock(Tree.class);
PropertyState path = PropertyStates.createProperty(REP_EFFECTIVE_PATH, oakPath);
when(t.getProperty(REP_EFFECTIVE_PATH)).thenReturn(path);
- PropertyState privs = PropertyStates.createProperty(REP_PRIVILEGES, ImmutableList.copyOf(privilegeNames), Type.NAMES);
+ PropertyState privs = PropertyStates.createProperty(REP_PRIVILEGES, Arrays.asList(privilegeNames), Type.NAMES);
when(t.getProperty(REP_PRIVILEGES)).thenReturn(privs);
Tree rTree = when(mock(Tree.class).getProperties()).thenReturn(Collections.emptySet()).getMock();
when(t.getChild(REP_RESTRICTIONS)).thenReturn(rTree);
diff --git a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImporterTest.java b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImporterTest.java
index b969900f80..a6aabe5137 100644
--- a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImporterTest.java
+++ b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalPolicyImporterTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.api.security.user.User;
@@ -53,6 +52,7 @@ import javax.jcr.security.AccessControlException;
import javax.jcr.security.AccessControlPolicy;
import java.security.Principal;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -148,10 +148,10 @@ public class PrincipalPolicyImporterTest extends AbstractPrincipalBasedTest {
}
private List<PropInfo> mockPropInfos(@NotNull Map<String, Value[]> restrictions) throws RepositoryException {
- List<PropInfo> propInfos = new ArrayList();
+ List<PropInfo> propInfos = new ArrayList<>();
for (Map.Entry<String,Value[]> r : restrictions.entrySet()) {
String jcrName = r.getKey();
- List<Value> vs = ImmutableList.copyOf(r.getValue());
+ List<Value> vs = Arrays.asList(r.getValue());
PropInfo propInfo = mockPropInfo(jcrName);
if (!vs.isEmpty()) {
TextValue first = when(mock(TextValue.class).getString()).thenReturn(vs.get(0).getString()).getMock();
@@ -574,7 +574,7 @@ public class PrincipalPolicyImporterTest extends AbstractPrincipalBasedTest {
// rep:privileges with wrong type
PropInfo propInfo = mockPropInfo(getJcrName(REP_PRIVILEGES));
TextValue tx = when(mock(TextValue.class).getString()).thenReturn(getJcrName(JCR_READ)).getMock();
- List values = ImmutableList.of(tx);
+ List values = List.of(tx);
when(propInfo.getTextValues()).thenReturn(values);
when(propInfo.getType()).thenReturn(PropertyType.STRING);
propInfos.add(propInfo);
diff --git a/oak-blob-cloud/src/test/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3DataStoreUtils.java b/oak-blob-cloud/src/test/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3DataStoreUtils.java
index 7b4a9afa1c..b0e0c15fb4 100644
--- a/oak-blob-cloud/src/test/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3DataStoreUtils.java
+++ b/oak-blob-cloud/src/test/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3DataStoreUtils.java
@@ -41,7 +41,6 @@ import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.amazonaws.services.s3.transfer.TransferManager;
import org.apache.jackrabbit.guava.common.base.Strings;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.core.data.DataStore;
@@ -66,7 +65,7 @@ public class S3DataStoreUtils extends DataStoreUtils {
protected static Class S3 = S3DataStore.class;
public static List<String> getFixtures() {
- return ImmutableList.of(S3.getName());
+ return List.of(S3.getName());
}
public static boolean isS3DataStore() {
diff --git a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
index 1d577b893b..e36a569579 100644
--- a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
+++ b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.blob;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.core.data.DataIdentifier;
import org.apache.jackrabbit.core.data.DataRecord;
import org.apache.jackrabbit.core.data.DataStoreException;
@@ -79,7 +77,7 @@ public class SharedDataStoreMarkSweepGarbageCollectorTest {
@Before
public void setUp() throws IOException {
when(whiteboard.track(CheckpointMBean.class)).thenReturn(tracker);
- when(tracker.getServices()).thenReturn(ImmutableList.of(checkpointMBean));
+ when(tracker.getServices()).thenReturn(List.of(checkpointMBean));
when(blobStore.getType()).thenReturn(SHARED);
@@ -116,7 +114,7 @@ public class SharedDataStoreMarkSweepGarbageCollectorTest {
@Test
public void markAndSweepShouldSucceedWhenAllRepositoriesAreAvailable() throws Exception {
setupSharedDataRecords("REPO1", "REPO1");
- when(blobStore.getAllChunkIds(0L)).thenReturn(ImmutableList.<String>of().iterator());
+ when(blobStore.getAllChunkIds(0L)).thenReturn(List.<String>of().iterator());
collector.markAndSweep(false, true);
@@ -133,8 +131,8 @@ public class SharedDataStoreMarkSweepGarbageCollectorTest {
DataRecord repoDataRecord = mock(DataRecord.class);
when(repoDataRecord.getIdentifier()).thenReturn(new DataIdentifier("repository-" + repoRepoId));
- List<DataRecord> refs = ImmutableList.of(refDataRecord);
- List<DataRecord> repos = ImmutableList.of(repoDataRecord);
+ List<DataRecord> refs = List.of(refDataRecord);
+ List<DataRecord> repos = List.of(repoDataRecord);
when(blobStore.getAllMetadataRecords(SharedDataStoreUtils.SharedStoreRecordType.REFERENCES.getType())).thenReturn(refs);
when(blobStore.getAllMetadataRecords(SharedDataStoreUtils.SharedStoreRecordType.REPOSITORY.getType())).thenReturn(repos);
diff --git a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreTest.java b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreTest.java
index a797063aff..028a88b650 100644
--- a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreTest.java
+++ b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreTest.java
@@ -29,9 +29,7 @@ import java.util.Random;
import java.util.Set;
import java.util.UUID;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.core.data.DataIdentifier;
@@ -170,7 +168,7 @@ public class DataStoreBlobStoreTest extends AbstractBlobStoreTest {
DataIdentifier d10 = new DataIdentifier("d-10");
DataIdentifier d20 = new DataIdentifier("d-20");
DataIdentifier d30 = new DataIdentifier("d-30");
- List<DataIdentifier> dis = ImmutableList.of(d10, d20, d30);
+ List<DataIdentifier> dis = List.of(d10, d20, d30);
List<DataRecord> recs = CollectionUtils.toList(
Iterables.transform(dis, input -> new TimeDataRecord(input)));
OakFileDataStore mockedDS = mock(OakFileDataStore.class);
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java
index 8011eb15b6..1cb0ecf497 100644
--- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java
@@ -37,7 +37,7 @@ import java.util.function.Function;
import org.apache.commons.io.LineIterator;
import org.apache.jackrabbit.guava.common.base.Splitter;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.commons.io.FileLineDifferenceIterator;
import org.jetbrains.annotations.Nullable;
import org.junit.Test;
@@ -159,12 +159,12 @@ public class FileLineDifferenceIteratorTest {
private static void assertReverseDiff(String marked, String all, List<String> diff) throws IOException {
Iterator<String> itr = createItr(all, marked);
- assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
+ assertThat("marked: " + marked + " all: " + all, CollectionUtils.toList(itr), is(diff));
}
private static void assertDiff(String marked, String all, List<String> diff) throws IOException {
Iterator<String> itr = createItr(marked, all);
- assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
+ assertThat("marked: " + marked + " all: " + all, CollectionUtils.toList(itr), is(diff));
}
private static Iterator<String> createItr(String marked, String all) throws IOException {
@@ -189,6 +189,6 @@ public class FileLineDifferenceIteratorTest {
}
});
- assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
+ assertThat("marked: " + marked + " all: " + all, CollectionUtils.toList(itr), is(diff));
}
}
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/sort/StringSortTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/sort/StringSortTest.java
index cf8423038a..1006d190ac 100644
--- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/sort/StringSortTest.java
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/sort/StringSortTest.java
@@ -28,8 +28,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -106,7 +105,7 @@ public class StringSortTest {
Collections.sort(paths, comparator);
collector.sort();
- List<String> sortedPaths = ImmutableList.copyOf(collector.getIds());
+ List<String> sortedPaths = CollectionUtils.toList(collector.getIds());
assertEquals(paths.size(), sortedPaths.size());
assertEquals(paths, sortedPaths);
}
@@ -123,7 +122,7 @@ public class StringSortTest {
if (permutation) {
List<String> newRoots = new ArrayList<>();
- CollectionUtils.permutations(rootPaths).
+ org.apache.commons.collections4.CollectionUtils.permutations(rootPaths).
stream().
sorted((a, b) -> Arrays.compare(a.toArray(new String[0]), b.toArray(new String[0]))).
forEach(permuts -> newRoots.add(String.join("", permuts)));
diff --git a/oak-core-spi/src/test/java/org/apache/jackrabbit/oak/spi/mount/MountInfoTest.java b/oak-core-spi/src/test/java/org/apache/jackrabbit/oak/spi/mount/MountInfoTest.java
index d8763fc186..33817431de 100644
--- a/oak-core-spi/src/test/java/org/apache/jackrabbit/oak/spi/mount/MountInfoTest.java
+++ b/oak-core-spi/src/test/java/org/apache/jackrabbit/oak/spi/mount/MountInfoTest.java
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.spi.mount;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -27,12 +25,13 @@ import org.apache.jackrabbit.oak.spi.mount.MountInfo;
import org.junit.Test;
import java.util.Collections;
+import java.util.List;
public class MountInfoTest {
@Test
public void testIsMounted() throws Exception{
- MountInfo md = new MountInfo("foo", false, of("/x/y"), of("/a", "/b"));
+ MountInfo md = new MountInfo("foo", false, List.of("/x/y"), List.of("/a", "/b"));
assertTrue(md.isMounted("/a"));
assertTrue(md.isMounted("/b"));
assertTrue(md.isMounted("/b/c/d"));
@@ -45,7 +44,7 @@ public class MountInfoTest {
@Test
public void testIsUnder() {
- MountInfo md = new MountInfo("foo", false, Collections.<String>emptyList(), of("/apps", "/etc/config", "/content/my/site", "/var"));
+ MountInfo md = new MountInfo("foo", false, Collections.emptyList(), List.of("/apps", "/etc/config", "/content/my/site", "/var"));
assertTrue(md.isUnder("/etc"));
assertTrue(md.isUnder("/content"));
assertTrue(md.isUnder("/content/my"));
@@ -56,7 +55,7 @@ public class MountInfoTest {
@Test
public void testIsDirectlyUnder() {
- MountInfo md = new MountInfo("foo", false, Collections.<String>emptyList(), of("/apps", "/etc/my/config", "/var"));
+ MountInfo md = new MountInfo("foo", false, Collections.<String>emptyList(), List.of("/apps", "/etc/my/config", "/var"));
assertFalse(md.isDirectlyUnder("/etc"));
assertTrue(md.isDirectlyUnder("/etc/my"));
assertFalse(md.isDirectlyUnder("/etc/my/config"));
@@ -65,7 +64,7 @@ public class MountInfoTest {
@Test
public void testSupportFragment() {
- MountInfo md = new MountInfo("foo", false, of("/apps", "/libs/*/site", "/content/*$", "/var$"), Collections.emptyList());
+ MountInfo md = new MountInfo("foo", false, List.of("/apps", "/libs/*/site", "/content/*$", "/var$"), Collections.emptyList());
assertFalse(md.isSupportFragment("/"));
assertTrue(md.isSupportFragment("/apps"));
@@ -86,7 +85,7 @@ public class MountInfoTest {
@Test
public void testSupportFragmentUnder() {
- MountInfo md = new MountInfo("foo", false, of("/apps", "/libs/*/site", "/content/*$", "/var$"), Collections.emptyList());
+ MountInfo md = new MountInfo("foo", false, List.of("/apps", "/libs/*/site", "/content/*$", "/var$"), Collections.emptyList());
assertTrue(md.isSupportFragmentUnder("/"));
assertTrue(md.isSupportFragmentUnder("/apps"));
@@ -107,7 +106,7 @@ public class MountInfoTest {
@Test
public void testIsMountedWithFragments() {
- MountInfo md = new MountInfo("foo", false, of("/apps", "/libs/*/site", "/content/*$", "/var$"), Collections.emptyList());
+ MountInfo md = new MountInfo("foo", false, List.of("/apps", "/libs/*/site", "/content/*$", "/var$"), Collections.emptyList());
assertFalse(md.isMounted("/oak:mount-foo"));
assertTrue(md.isMounted("/apps/oak:mount-foo"));
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/core/SecureNodeBuilderTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/core/SecureNodeBuilderTest.java
index 3eb02946fe..76b232d885 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/core/SecureNodeBuilderTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/core/SecureNodeBuilderTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.core;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.LazyValue;
@@ -31,6 +30,8 @@ import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.junit.Before;
import org.junit.Test;
+import java.util.List;
+
import static org.apache.jackrabbit.oak.core.TestPermissionProvider.NAME_ACCESSIBLE;
import static org.apache.jackrabbit.oak.core.TestPermissionProvider.NAME_NON_ACCESSIBLE;
import static org.apache.jackrabbit.oak.core.TestPermissionProvider.NAME_NON_EXISTING;
@@ -266,7 +267,7 @@ public class SecureNodeBuilderTest {
@Test
public void testGetPropertiesAfterSet() {
- secureNodeBuilder.setProperty(PropertyStates.createProperty("another", ImmutableList.of("v", "v2"), Type.STRINGS));
+ secureNodeBuilder.setProperty(PropertyStates.createProperty("another", List.of("v", "v2"), Type.STRINGS));
assertEquals(2, Iterables.size(secureNodeBuilder.getProperties()));
}
@@ -291,7 +292,7 @@ public class SecureNodeBuilderTest {
@Test
public void testGetBooleanTypeBooleans() {
- secureNodeBuilder.setProperty("booleans", ImmutableList.of(true, false), Type.BOOLEANS);
+ secureNodeBuilder.setProperty("booleans", List.of(true, false), Type.BOOLEANS);
assertFalse(secureNodeBuilder.getBoolean("booleans"));
}
@@ -304,7 +305,7 @@ public class SecureNodeBuilderTest {
@Test
public void testGetStringTypeStrings() {
- secureNodeBuilder.setProperty("strings", ImmutableList.of("a", "b"), Type.STRINGS);
+ secureNodeBuilder.setProperty("strings", List.of("a", "b"), Type.STRINGS);
assertNull(secureNodeBuilder.getString("strings"));
}
@@ -323,7 +324,7 @@ public class SecureNodeBuilderTest {
@Test
public void testGetNameTypeNames() {
- secureNodeBuilder.setProperty("names", ImmutableList.of("a", "b"), Type.NAMES);
+ secureNodeBuilder.setProperty("names", List.of("a", "b"), Type.NAMES);
assertNull(secureNodeBuilder.getName("names"));
}
@@ -342,7 +343,7 @@ public class SecureNodeBuilderTest {
@Test
public void testGetNamesTypeNames() {
- Iterable<String> names = ImmutableList.of("a", "b");
+ Iterable<String> names = List.of("a", "b");
secureNodeBuilder.setProperty("names", names, Type.NAMES);
assertTrue(Iterables.elementsEqual(names, secureNodeBuilder.getNames("names")));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/atomic/AtomicCounterEditorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/atomic/AtomicCounterEditorTest.java
index a68a3d0847..0c4f1df13f 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/atomic/AtomicCounterEditorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/atomic/AtomicCounterEditorTest.java
@@ -17,7 +17,7 @@
package org.apache.jackrabbit.oak.plugins.atomic;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
+
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
import static org.apache.jackrabbit.oak.api.Type.LONG;
import static org.apache.jackrabbit.oak.api.Type.NAMES;
@@ -213,7 +213,7 @@ public class AtomicCounterEditorTest {
}
private static NodeBuilder setMixin(@NotNull final NodeBuilder builder) {
- return requireNonNull(builder).setProperty(JCR_MIXINTYPES, of(MIX_ATOMIC_COUNTER), NAMES);
+ return requireNonNull(builder).setProperty(JCR_MIXINTYPES, List.of(MIX_ATOMIC_COUNTER), NAMES);
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/cow/COWNodeStoreTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/cow/COWNodeStoreTest.java
index 65501c3255..f90d547910 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/cow/COWNodeStoreTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/cow/COWNodeStoreTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.cow;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
@@ -27,6 +26,7 @@ import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.junit.Before;
import org.junit.Test;
+import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
@@ -96,7 +96,7 @@ public class COWNodeStoreTest {
info = cowNodeStore.checkpointInfo(checkpoint2);
assertEquals("The new checkpoint is not available", Map.of("k", "v2"), info);
assertTrue("The retrieve() doesn't work for the new checkpoint", cowNodeStore.retrieve(checkpoint2).hasChildNode("foo"));
- assertEquals(ImmutableList.of(checkpoint1, checkpoint2), cowNodeStore.checkpoints());
+ assertEquals(List.of(checkpoint1, checkpoint2), cowNodeStore.checkpoints());
assertTrue("The new checkpoint shouldn't be stored in the main store", store.checkpointInfo(checkpoint2).isEmpty());
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java
index 4ccea8d9fe..d70eb184c6 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java
@@ -97,7 +97,6 @@ import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Maps;
import ch.qos.logback.classic.Level;
@@ -1880,7 +1879,7 @@ public class AsyncIndexUpdateTest {
AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider);
CollectingValidatorProvider v = new CollectingValidatorProvider();
- async.setValidatorProviders(ImmutableList.<ValidatorProvider>of(v));
+ async.setValidatorProviders(List.of(v));
async.run();
assertFalse(v.visitedPaths.isEmpty());
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateTest.java
index cb2e87faaf..30931b342c 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateTest.java
@@ -44,12 +44,12 @@ import static org.junit.Assert.fail;
import java.util.Calendar;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import ch.qos.logback.classic.Level;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
@@ -554,15 +554,15 @@ public class IndexUpdateTest {
// create async defs with nrt and sync mixed in
createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME),
"asyncIndex", true, false, Set.of("foo"), null)
- .setProperty(ASYNC_PROPERTY_NAME, ImmutableList.of("async-run"), Type.STRINGS)
+ .setProperty(ASYNC_PROPERTY_NAME, List.of("async-run"), Type.STRINGS)
.setProperty(REINDEX_PROPERTY_NAME, false);
createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME),
"nrtIndex", true, false, Set.of("foo"), null)
- .setProperty(ASYNC_PROPERTY_NAME, ImmutableList.of("async-run", "nrt"), Type.STRINGS)
+ .setProperty(ASYNC_PROPERTY_NAME, List.of("async-run", "nrt"), Type.STRINGS)
.setProperty(REINDEX_PROPERTY_NAME, false);
createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME),
"asyncSyncIndex", true, false, Set.of("foo"), null)
- .setProperty(ASYNC_PROPERTY_NAME, ImmutableList.of("async-run", "sync"), Type.STRINGS)
+ .setProperty(ASYNC_PROPERTY_NAME, List.of("async-run", "sync"), Type.STRINGS)
.setProperty(REINDEX_PROPERTY_NAME, false);
// node states to run hook on
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexDefinitionUpdaterTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexDefinitionUpdaterTest.java
index 2ace0da3ad..dac5aa1499 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexDefinitionUpdaterTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexDefinitionUpdaterTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.importer;
import java.io.File;
@@ -27,12 +26,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.felix.inventory.Format;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.index.inventory.IndexDefinitionPrinter;
import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
import org.apache.jackrabbit.oak.plugins.tree.factories.TreeFactory;
@@ -144,7 +143,7 @@ public class IndexDefinitionUpdaterTest {
NodeBuilder idxBuilder = updater.apply(builder, "/oak:index/barIndex");
PropertyState childOrder = builder.getChildNode("oak:index").getProperty(":childOrder");
- List<String> names = ImmutableList.copyOf(childOrder.getValue(Type.NAMES));
+ List<String> names = CollectionUtils.toList(childOrder.getValue(Type.NAMES));
assertEquals(asList("fooIndex", "barIndex"), names);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexQueryTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexQueryTest.java
index b641d3bb32..750c36ae2f 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexQueryTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexQueryTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index.nodetype;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.createIndexDefinition;
@@ -62,7 +61,7 @@ public class NodeTypeIndexQueryTest extends AbstractQueryTest {
private static void mixLanguage(Tree t, String n) {
Tree c = t.addChild(n);
c.setProperty(JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME);
- c.setProperty(JCR_MIXINTYPES, of("mix:language"), Type.NAMES);
+ c.setProperty(JCR_MIXINTYPES, List.of("mix:language"), Type.NAMES);
}
@Test
@@ -86,8 +85,8 @@ public class NodeTypeIndexQueryTest extends AbstractQueryTest {
assertQuery("select [jcr:path] from [nt:unstructured] ",
new ArrayList<String>());
- assertQuery("select [jcr:path] from [nt:folder] ", of("/c", "/d"));
- assertQuery("select [jcr:path] from [mix:language] ", of("/e", "/f"));
+ assertQuery("select [jcr:path] from [nt:folder] ", List.of("/c", "/d"));
+ assertQuery("select [jcr:path] from [mix:language] ", List.of("/e", "/f"));
setTraversalEnabled(true);
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultiPropertyOrTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultiPropertyOrTest.java
index b10262c6a2..31df7419fe 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultiPropertyOrTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultiPropertyOrTest.java
@@ -30,7 +30,6 @@ import java.util.Random;
import javax.jcr.query.Query;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.ContentRepository;
@@ -61,7 +60,7 @@ public class MultiPropertyOrTest extends AbstractQueryTest {
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
IndexUtils.createIndexDefinition(
index, "xyz", true, false,
- ImmutableList.of("x", "y", "z", "w"), null);
+ List.of("x", "y", "z", "w"), null);
}
})
.with(new OpenSecurityProvider())
@@ -79,7 +78,7 @@ public class MultiPropertyOrTest extends AbstractQueryTest {
root.commit();
setTraversalEnabled(false);
assertQuery("select [jcr:path] from [nt:base] where [x] is not null",
- ImmutableList.of("/a"));
+ List.of("/a"));
List<String> lines = executeQuery(
"explain select [jcr:path] from [nt:base] where [x] is not null",
@@ -105,13 +104,13 @@ public class MultiPropertyOrTest extends AbstractQueryTest {
assertQuery(
"select [jcr:path] from [nt:base] where [x] = 'foo' OR [y] = 'foo'",
- ImmutableList.of("/a"));
+ List.of("/a"));
assertQuery(
"select [jcr:path] from [nt:base] where [x] = 'foo' OR [z] = 'foo'",
- ImmutableList.of("/a", "/c"));
+ List.of("/a", "/c"));
assertQuery(
"select [jcr:path] from [nt:base] where [x] = 'foo' OR [y] = 'bar'",
- ImmutableList.of("/a", "/b"));
+ List.of("/a", "/b"));
setTraversalEnabled(false);
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultipleIndicesTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultipleIndicesTest.java
index baac33ba97..58cd459cad 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultipleIndicesTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/MultipleIndicesTest.java
@@ -20,6 +20,7 @@ import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.createIndexDefi
import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.getOrCreateOakIndex;
import java.util.ArrayList;
+import java.util.List;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -33,8 +34,6 @@ import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
public class MultipleIndicesTest extends AbstractQueryTest {
@Override
@@ -46,10 +45,10 @@ public class MultipleIndicesTest extends AbstractQueryTest {
public void initialize(@NotNull NodeBuilder builder) {
createIndexDefinition(
getOrCreateOakIndex(builder), "pid",
- true, false, ImmutableList.of("pid"), null);
+ true, false, List.of("pid"), null);
createIndexDefinition(
getOrCreateOakIndex(builder.child("content")),
- "pid", true, false, ImmutableList.of("pid"),
+ "pid", true, false, List.of("pid"),
null);
}
})
@@ -80,13 +79,13 @@ public class MultipleIndicesTest extends AbstractQueryTest {
new ArrayList<String>());
assertQuery("select [jcr:path] from [nt:base] where [pid] = 'foo'",
- ImmutableList.of("/", "/a", "/c", "/content/x"));
+ List.of("/", "/a", "/c", "/content/x"));
assertQuery("select [jcr:path] from [nt:base] where [pid] = 'bar'",
- ImmutableList.of("/b", "/content/z"));
+ List.of("/b", "/content/z"));
assertQuery("select [jcr:path] from [nt:base] where [pid] = 'baz'",
- ImmutableList.of("/content/y"));
+ List.of("/content/y"));
setTraversalEnabled(true);
}
@@ -109,11 +108,11 @@ public class MultipleIndicesTest extends AbstractQueryTest {
setTraversalEnabled(false);
assertQuery("select [jcr:path] from [nt:base] where [pid] = 'value'",
- ImmutableList.of("/node-1"));
+ List.of("/node-1"));
assertQuery("select [jcr:path] from [nt:base] where [pid] = ''",
- ImmutableList.of("/node-2"));
+ List.of("/node-2"));
assertQuery("select [jcr:path] from [nt:base] where [pid] = ':'",
- ImmutableList.of("/node-3"));
+ List.of("/node-3"));
setTraversalEnabled(true);
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
index 7e64b603af..e594b0d9ce 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
@@ -30,7 +30,6 @@ import java.util.List;
import javax.jcr.RepositoryException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
@@ -60,7 +59,7 @@ public class OrderedPropertyIndexEditorProviderTest {
private NodeBuilder createIndexDef(NodeBuilder root) throws RepositoryException {
return IndexUtils.createIndexDefinition(
root.child(IndexConstants.INDEX_DEFINITIONS_NAME), indexName, false,
- ImmutableList.of(indexedProperty), null, OrderedIndex.TYPE, null);
+ List.of(indexedProperty), null, OrderedIndex.TYPE, null);
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
index aa1269a518..d977728e40 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
@@ -23,7 +23,6 @@ import java.util.List;
import javax.jcr.query.Query;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.ContentRepository;
import org.apache.jackrabbit.oak.api.Tree;
@@ -49,7 +48,7 @@ public class RelativePathTest extends AbstractQueryTest {
public void initialize(@NotNull NodeBuilder builder) {
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
IndexUtils.createIndexDefinition(index, "myProp", true,
- false, ImmutableList.<String>of("myProp"), null);
+ false, List.of("myProp"), null);
}
})
.with(new OpenSecurityProvider())
@@ -68,7 +67,7 @@ public class RelativePathTest extends AbstractQueryTest {
root.commit();
setTraversalEnabled(false);
assertQuery("select [jcr:path] from [nt:base] where [n/myProp] is not null",
- ImmutableList.of("/a", "/b"));
+ List.of("/a", "/b"));
List<String> lines = executeQuery(
"explain select [jcr:path] from [nt:base] where [n/myProp] is not null",
@@ -79,7 +78,7 @@ public class RelativePathTest extends AbstractQueryTest {
assertQuery(
"select [jcr:path] from [nt:base] where [n/myProp] = 'foo'",
- ImmutableList.of("/a"));
+ List.of("/a"));
setTraversalEnabled(false);
}
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/SinglePropertyIndexQueryTests.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/SinglePropertyIndexQueryTests.java
index 9086156f8c..3e55d5d2d3 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/SinglePropertyIndexQueryTests.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/SinglePropertyIndexQueryTests.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index.property;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.oak.api.Type.NAMES;
import static org.apache.jackrabbit.oak.api.Type.STRINGS;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.PROPERTY_NAMES;
@@ -49,7 +48,7 @@ public class SinglePropertyIndexQueryTests extends AbstractQueryTest {
@Override
protected void createTestIndexNode() throws Exception {
Tree index = super.createTestIndexNode(root.getTree("/"), TYPE);
- index.setProperty(PROPERTY_NAMES, of(INDEXED_PROPERTY), NAMES);
+ index.setProperty(PROPERTY_NAMES, List.of(INDEXED_PROPERTY), NAMES);
index.setProperty(REINDEX_PROPERTY_NAME, true);
root.commit();
}
@@ -66,19 +65,19 @@ public class SinglePropertyIndexQueryTests extends AbstractQueryTest {
// adding /content/node1 { a, b }
Tree node = content.addChild("node1");
- node.setProperty(INDEXED_PROPERTY, of("a", "b"), STRINGS);
+ node.setProperty(INDEXED_PROPERTY, List.of("a", "b"), STRINGS);
expected.add(node.getPath());
// adding /content/node2 { c, d }
node = content.addChild("node2");
- node.setProperty(INDEXED_PROPERTY, of("c", "d"), STRINGS);
+ node.setProperty(INDEXED_PROPERTY, List.of("c", "d"), STRINGS);
expected.add(node.getPath());
// adding nodes with {a, x} and {c, x} these should not be returned
node = content.addChild("node3");
- node.setProperty(INDEXED_PROPERTY, of("a", "x"), STRINGS);
+ node.setProperty(INDEXED_PROPERTY, List.of("a", "x"), STRINGS);
node = content.addChild("node4");
- node.setProperty(INDEXED_PROPERTY, of("c", "x"), STRINGS);
+ node.setProperty(INDEXED_PROPERTY, List.of("c", "x"), STRINGS);
root.commit();
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePatternPropertyIndexTests.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePatternPropertyIndexTests.java
index bf86b4d5ba..49eb50bd37 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePatternPropertyIndexTests.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePatternPropertyIndexTests.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index.property;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.oak.api.Type.NAMES;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.PROPERTY_NAMES;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_PROPERTY_NAME;
@@ -34,6 +33,8 @@ import org.apache.jackrabbit.oak.query.AbstractQueryTest;
import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
import org.junit.Test;
+import java.util.List;
+
public class ValuePatternPropertyIndexTests extends AbstractQueryTest {
private static final String INDEXED_PROPERTY = "indexedProperty";
@@ -57,7 +58,7 @@ public class ValuePatternPropertyIndexTests extends AbstractQueryTest {
private void valuePattern(String middle, String plan) throws Exception {
Tree index = super.createTestIndexNode(root.getTree("/"), TYPE);
- index.setProperty(PROPERTY_NAMES, of(INDEXED_PROPERTY), NAMES);
+ index.setProperty(PROPERTY_NAMES, List.of(INDEXED_PROPERTY), NAMES);
index.setProperty(IndexConstants.VALUE_INCLUDED_PREFIXES, "hello" + middle + "world");
index.setProperty(REINDEX_PROPERTY_NAME, true);
root.commit();
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
index f00db7a58b..97ad3cce87 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.jackrabbit.oak.plugins.index.property.strategy;
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static java.util.Arrays.asList;
+
+import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.ENTRY_COUNT_PROPERTY_NAME;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_CONTENT_NODE_NAME;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.KEY_COUNT_PROPERTY_NAME;
@@ -31,12 +31,14 @@ import static org.junit.Assert.assertThat;
import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.query.index.FilterImpl;
import org.apache.jackrabbit.oak.spi.query.Filter;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -306,21 +308,21 @@ public class ContentMirrorStoreStrategyTest {
indexMeta.setChildNode(INDEX_CONTENT_NODE_NAME, builder.getNodeState());
Iterable<String> paths = store.query(filter, null, indexMeta.getNodeState(), KEY);
- assertThat(copyOf(paths), containsInAnyOrder("a", "a/c", "b"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("a", "a/c", "b"));
FilterImpl filter2 = FilterImpl.newTestInstance();
filter2.restrictPath("/content/a", Filter.PathRestriction.ALL_CHILDREN);
paths = store.query(filter2, null, indexMeta.getNodeState(), KEY);
- assertThat(copyOf(paths), containsInAnyOrder("a", "a/c"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("a", "a/c"));
store = new ContentMirrorStoreStrategy(INDEX_CONTENT_NODE_NAME, "/content", true);
paths = store.query(filter, null, indexMeta.getNodeState(), KEY);
- assertThat(copyOf(paths), containsInAnyOrder("/content/a", "/content/a/c", "/content/b"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("/content/a", "/content/a/c", "/content/b"));
paths = store.query(filter2, null, indexMeta.getNodeState(), KEY);
- assertThat(copyOf(paths), containsInAnyOrder("/content/a", "/content/a/c"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("/content/a", "/content/a/c"));
}
private static void assertInRange(String msg, double expected, double actual) {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndexTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndexTest.java
index c68b1caf3a..4179578b1e 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndexTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndexTest.java
@@ -47,7 +47,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.JcrConstants.JCR_UUID;
import static org.apache.jackrabbit.JcrConstants.NT_BASE;
import static org.apache.jackrabbit.oak.plugins.memory.PropertyStates.createProperty;
@@ -80,11 +79,11 @@ public class ReferenceIndexTest {
FilterImpl f = createFilter(indexed, NT_BASE);
f.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.REFERENCE);
- assertFilter(f, new ReferenceIndex(), indexed, of("/a", "/b"));
+ assertFilter(f, new ReferenceIndex(), indexed, List.of("/a", "/b"));
FilterImpl f2 = createFilter(indexed, NT_BASE);
f2.restrictProperty("*", Operator.EQUAL, newReference("u2"), PropertyType.WEAKREFERENCE);
- assertFilter(f2, new ReferenceIndex(), indexed, of("/c"));
+ assertFilter(f2, new ReferenceIndex(), indexed, List.of("/c"));
}
@Test
@@ -117,11 +116,11 @@ public class ReferenceIndexTest {
f.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.REFERENCE);
// System.out.println(NodeStateUtils.toString(NodeStateUtils.getNode(indexed, "/oak:index/reference")));
- assertFilter(f, referenceIndex, indexed, of("/a/x", "/b"));
+ assertFilter(f, referenceIndex, indexed, List.of("/a/x", "/b"));
FilterImpl f2 = createFilter(indexed, NT_BASE);
f2.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.WEAKREFERENCE);
- assertFilter(f2, referenceIndex, indexed, of("/c", "/a/y"));
+ assertFilter(f2, referenceIndex, indexed, List.of("/c", "/a/y"));
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
index 1a1102c218..55bd4b463b 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
@@ -30,8 +30,8 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Collections;
+import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
@@ -129,7 +129,7 @@ public class TypeEditorTest {
NodeBuilder testNode = builder.child("testNode");
testNode.setProperty(JCR_PRIMARYTYPE, NT_FOLDER, Type.NAME);
- testNode.setProperty(JCR_MIXINTYPES, ImmutableList.of("mix:title"), Type.NAMES);
+ testNode.setProperty(JCR_MIXINTYPES, List.of("mix:title"), Type.NAMES);
testNode.setProperty("jcr:title", true);
try {
@@ -148,7 +148,7 @@ public class TypeEditorTest {
NodeBuilder builder = root.builder();
NodeBuilder testNode = builder.child("testNode");
testNode.setProperty(JCR_PRIMARYTYPE, NT_FOLDER, Type.NAME);
- testNode.setProperty(JCR_MIXINTYPES, ImmutableList.of("mix:title"), Type.NAMES);
+ testNode.setProperty(JCR_MIXINTYPES, List.of("mix:title"), Type.NAMES);
testNode.setProperty("jcr:title", "title");
NodeState before = builder.getNodeState();
@@ -177,7 +177,7 @@ public class TypeEditorTest {
NodeBuilder ace = acl.child("first");
ace.setProperty(JCR_PRIMARYTYPE, AccessControlConstants.NT_REP_GRANT_ACE, Type.NAME);
ace.setProperty(AccessControlConstants.REP_PRINCIPAL_NAME, EveryonePrincipal.NAME);
- ace.setProperty(AccessControlConstants.REP_PRIVILEGES, ImmutableList.of(PrivilegeConstants.JCR_READ), Type.STRINGS);
+ ace.setProperty(AccessControlConstants.REP_PRIVILEGES, List.of(PrivilegeConstants.JCR_READ), Type.STRINGS);
try {
hook.processCommit(before, builder.getNodeState(), CommitInfo.EMPTY);
@@ -199,12 +199,12 @@ public class TypeEditorTest {
NodeBuilder ace = acl.child("first");
ace.setProperty(JCR_PRIMARYTYPE, AccessControlConstants.NT_REP_GRANT_ACE, Type.NAME);
ace.setProperty(AccessControlConstants.REP_PRINCIPAL_NAME, EveryonePrincipal.NAME);
- ace.setProperty(AccessControlConstants.REP_PRIVILEGES, ImmutableList.of(PrivilegeConstants.JCR_READ), Type.NAMES);
+ ace.setProperty(AccessControlConstants.REP_PRIVILEGES, List.of(PrivilegeConstants.JCR_READ), Type.NAMES);
NodeState before = builder.getNodeState();
// change to invalid type
- ace.setProperty(AccessControlConstants.REP_PRIVILEGES, ImmutableList.of(PrivilegeConstants.JCR_READ), Type.STRINGS);
+ ace.setProperty(AccessControlConstants.REP_PRIVILEGES, List.of(PrivilegeConstants.JCR_READ), Type.STRINGS);
try {
hook.processCommit(before, builder.getNodeState(), CommitInfo.EMPTY);
@@ -316,7 +316,7 @@ public class TypeEditorTest {
builder = root.builder();
before = builder.getNodeState();
- builder.child("testcontent").setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REFERENCEABLE), Type.NAMES);
+ builder.child("testcontent").setProperty(JCR_MIXINTYPES, List.of(MIX_REFERENCEABLE), Type.NAMES);
try {
hook.processCommit(before, builder.getNodeState(), CommitInfo.EMPTY);
fail("should not be able to change mixin due to illegal uuid format");
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java
index ee0cde6907..2f878c65da 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeRegistryTest.java
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.plugins.nodetype.write;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;
import static org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.JcrConstants.NT_BASE;
@@ -143,7 +142,7 @@ public class NodeTypeRegistryTest {
Tree test = root.getTree("/").addChild("test");
test.setProperty(JCR_PRIMARYTYPE, NT_FOLDER, NAME);
- test.setProperty(JCR_MIXINTYPES, of(MIX_INDEXABLE), Type.NAMES);
+ test.setProperty(JCR_MIXINTYPES, List.of(MIX_INDEXABLE), Type.NAMES);
test.addChild("oak:index").setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
root.commit();
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyInexistenceTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyInexistenceTest.java
index 8aecb03eca..5d6f4ff9fd 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyInexistenceTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyInexistenceTest.java
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.query;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.InitialContent;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.ContentRepository;
@@ -64,10 +62,10 @@ public class PropertyInexistenceTest extends AbstractQueryTest {
root.commit();
String query1 = "SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a') AND [z] IS NULL";
- List<String> expected1 = ImmutableList.of("/a/x", "/a/x/y");
+ List<String> expected1 = List.of("/a/x", "/a/x/y");
String query2 = "SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a/x') AND [z] IS NULL";
- List<String> expected2 = ImmutableList.of("/a/x/y");
+ List<String> expected2 = List.of("/a/x/y");
assertQuery(query1, expected1);
assertQuery(query2, expected2);
@@ -88,12 +86,12 @@ public class PropertyInexistenceTest extends AbstractQueryTest {
root.commit();
String query1 = "SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a') AND [y/z] IS NULL";
- List<String> expected1 = ImmutableList.of("/a/x", "/a/x/y", "/a/x1");
- List<String> expectedOld1 = ImmutableList.of("/a/x");
+ List<String> expected1 = List.of("/a/x", "/a/x/y", "/a/x1");
+ List<String> expectedOld1 = List.of("/a/x");
String query2 = "SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a/x') AND [y/z] IS NULL";
- List<String> expected2 = ImmutableList.of("/a/x/y");
- List<String> expectedOld2 = ImmutableList.of();
+ List<String> expected2 = List.of("/a/x/y");
+ List<String> expectedOld2 = List.of();
assertQuery(query1, expected1);
assertQuery(query2, expected2);
@@ -112,8 +110,8 @@ public class PropertyInexistenceTest extends AbstractQueryTest {
System.setProperty("oak.useOldInexistenceCheck", "false");
String query3 = "SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a/x2') AND [y/z] IS NULL";
- List<String> expected3 = ImmutableList.of("/a/x2/z", "/a/x2/z1/y");
- List<String> expectedOld3 = ImmutableList.of();
+ List<String> expected3 = List.of("/a/x2/z", "/a/x2/z1/y");
+ List<String> expectedOld3 = List.of();
assertQuery(query3, expected3);
@@ -131,8 +129,8 @@ public class PropertyInexistenceTest extends AbstractQueryTest {
root.commit();
String query = "SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a') AND [w/y/z] IS NULL";
- List<String> expected = ImmutableList.of("/a/x", "/a/x1", "/a/x1/w", "/a/x2", "/a/x2/w", "/a/x2/w/y");
- List<String> expectedOld = ImmutableList.of("/a/x2");
+ List<String> expected = List.of("/a/x", "/a/x1", "/a/x1/w", "/a/x2", "/a/x2/w", "/a/x2/w/y");
+ List<String> expectedOld = List.of("/a/x2");
assertQuery(query, expected);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryCostOverheadTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryCostOverheadTest.java
index 24d437e115..77298990ed 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryCostOverheadTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryCostOverheadTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.query;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -29,6 +28,8 @@ import org.apache.jackrabbit.oak.query.ast.FullTextSearchImpl;
import org.apache.jackrabbit.oak.query.ast.OrImpl;
import org.junit.Test;
+import java.util.List;
+
public class QueryCostOverheadTest {
@Test
public void getCostOverhead() {
@@ -54,14 +55,14 @@ public class QueryCostOverheadTest {
c1 = new ComparisonImpl(null, null, null);
c2 = new FullTextSearchImpl(null, null, null);
c3 = new FullTextSearchImpl(null, null, null);
- c = new OrImpl(of(c1, c2, c3));
+ c = new OrImpl(List.of(c1, c2, c3));
query = createQuery(c);
assertTrue(query.containsUnfilteredFullTextCondition());
c2 = new FullTextSearchImpl(null, null, null);
c3 = new FullTextSearchImpl(null, null, null);
c4 = new ComparisonImpl(null, null, null);
- c1 = new OrImpl(of(c2, c3, c4));
+ c1 = new OrImpl(List.of(c2, c3, c4));
c5 = mock(DescendantNodeImpl.class);
c = new AndImpl(c1, c5);
query = createQuery(c);
@@ -74,20 +75,20 @@ public class QueryCostOverheadTest {
c1 = new FullTextSearchImpl(null, null, null);
c2 = new FullTextSearchImpl(null, null, null);
c3 = new FullTextSearchImpl(null, null, null);
- c = new OrImpl(of(c1, c2, c3));
+ c = new OrImpl(List.of(c1, c2, c3));
query = createQuery(c);
assertFalse(query.containsUnfilteredFullTextCondition());
c1 = new ComparisonImpl(null, null, null);
c2 = new FullTextSearchImpl(null, null, null);
c3 = new FullTextSearchImpl(null, null, null);
- c = new AndImpl(of(c1, c2, c3));
+ c = new AndImpl(List.of(c1, c2, c3));
query = createQuery(c);
assertFalse(query.containsUnfilteredFullTextCondition());
c1 = new ComparisonImpl(null, null, null);
c2 = new ComparisonImpl(null, null, null);
- c = new AndImpl(of(c1, c2, c3));
+ c = new AndImpl(List.of(c1, c2, c3));
query = createQuery(c);
assertFalse(query.containsUnfilteredFullTextCondition());
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/SQL2OptimiseQueryTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/SQL2OptimiseQueryTest.java
index f8685022ec..8092a1f191 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/SQL2OptimiseQueryTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/SQL2OptimiseQueryTest.java
@@ -16,9 +16,7 @@
*/
package org.apache.jackrabbit.oak.query;
-import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
-import static javax.jcr.query.Query.JCR_SQL2;
+import static java.util.Objects.requireNonNull;import static javax.jcr.query.Query.JCR_SQL2;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.oak.api.Type.NAME;
import static org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants.NT_OAK_UNSTRUCTURED;
@@ -125,7 +123,7 @@ public class SQL2OptimiseQueryTest extends AbstractQueryTest {
statement = String.format("SELECT * FROM [%s] WHERE p = 'a' OR p = 'b'",
NT_OAK_UNSTRUCTURED);
- expected = of("/test/a", "/test/b", "/test2/a");
+ expected = List.of("/test/a", "/test/b", "/test2/a");
setQuerySelectionMode(ORIGINAL);
original = executeQuery(statement, JCR_SQL2, true);
setQuerySelectionMode(ALTERNATIVE);
@@ -137,7 +135,7 @@ public class SQL2OptimiseQueryTest extends AbstractQueryTest {
statement = String.format(
"SELECT * FROM [%s] WHERE p = 'a' OR p = 'b' OR p = 'c' OR p = 'd' OR p = 'e' ",
NT_OAK_UNSTRUCTURED);
- expected = of("/test/a", "/test/b", "/test/c", "/test/d", "/test/e", "/test2/a");
+ expected = List.of("/test/a", "/test/b", "/test/c", "/test/d", "/test/e", "/test2/a");
setQuerySelectionMode(ORIGINAL);
original = executeQuery(statement, JCR_SQL2, true);
setQuerySelectionMode(ALTERNATIVE);
@@ -149,7 +147,7 @@ public class SQL2OptimiseQueryTest extends AbstractQueryTest {
statement = String.format(
"SELECT * FROM [%s] WHERE (p = 'a' OR p = 'b') AND (p1 = 'a1' OR p1 = 'b1')",
NT_OAK_UNSTRUCTURED);
- expected = of("/test/a", "/test/b");
+ expected = List.of("/test/a", "/test/b");
setQuerySelectionMode(ORIGINAL);
original = executeQuery(statement, JCR_SQL2, true);
setQuerySelectionMode(ALTERNATIVE);
@@ -161,7 +159,8 @@ public class SQL2OptimiseQueryTest extends AbstractQueryTest {
statement = String.format(
"SELECT * FROM [%s] WHERE (p = 'a' AND p1 = 'a1') OR (p = 'b' AND p1 = 'b1')",
NT_OAK_UNSTRUCTURED);
- expected = of("/test/a", "/test/b");
+ expected = List.of("/test/a", "/test/b");
+ expected = List.of("/test/a", "/test/b");
setQuerySelectionMode(ORIGINAL);
original = executeQuery(statement, JCR_SQL2, true);
setQuerySelectionMode(ALTERNATIVE);
@@ -176,7 +175,7 @@ public class SQL2OptimiseQueryTest extends AbstractQueryTest {
+ "OR c.[p3] = 'a') "
+ "AND ISDESCENDANTNODE(c, '/test') "
+ "ORDER BY added DESC";
- expected = of("/test/a", "/test/b", "/test/c");
+ expected = List.of("/test/a", "/test/b", "/test/c");
setQuerySelectionMode(ORIGINAL);
original = executeQuery(statement, JCR_SQL2, true);
setQuerySelectionMode(ALTERNATIVE);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/TraversalAvoidanceTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/TraversalAvoidanceTest.java
index fc39b40057..f3e02547dc 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/TraversalAvoidanceTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/TraversalAvoidanceTest.java
@@ -44,8 +44,6 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
public class TraversalAvoidanceTest extends AbstractQueryTest {
Whiteboard wb;
@@ -192,7 +190,7 @@ public class TraversalAvoidanceTest extends AbstractQueryTest {
@NotNull
@Override
public List<? extends QueryIndex> getQueryIndexes(NodeState nodeState) {
- return ImmutableList.of(queryIndex);
+ return List.of(queryIndex);
}
}
@@ -248,7 +246,7 @@ public class TraversalAvoidanceTest extends AbstractQueryTest {
@Override
public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) {
- return ImmutableList.copyOf(plans);
+ return List.copyOf(plans);
}
@Override
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/IndexSelectionTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/IndexSelectionTest.java
index a6afdcbb30..ca77a4f17a 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/IndexSelectionTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/IndexSelectionTest.java
@@ -16,13 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.query.index;
import java.util.List;
import java.util.UUID;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.ContentRepository;
@@ -64,7 +62,7 @@ public class IndexSelectionTest extends AbstractQueryTest {
root.commit();
assertQuery("SELECT * FROM [nt:base] WHERE [jcr:uuid] = '"+uuid+"' ",
- ImmutableList.of("/"));
+ List.of("/"));
assertEquals("Test index plan should not be invoked",
0, testIndexProvider.index.invocationCount);
}
@@ -77,7 +75,7 @@ public class IndexSelectionTest extends AbstractQueryTest {
root.commit();
assertQuery("SELECT * FROM [nt:base] WHERE [jcr:uuid] is not null",
- ImmutableList.of("/"));
+ List.of("/"));
assertEquals("Test index plan should be invoked",
1, testIndexProvider.index.invocationCount);
}
@@ -91,7 +89,7 @@ public class IndexSelectionTest extends AbstractQueryTest {
root.commit();
assertQuery("SELECT * FROM [nt:base] WHERE [jcr:uuid] in('" + uuid + "', '" + uuid2 + "')",
- ImmutableList.of("/"));
+ List.of("/"));
assertEquals("Test index plan should be invoked",
1, testIndexProvider.index.invocationCount);
}
@@ -101,7 +99,7 @@ public class IndexSelectionTest extends AbstractQueryTest {
@NotNull
@Override
public List<? extends QueryIndex> getQueryIndexes(NodeState nodeState) {
- return ImmutableList.<QueryIndex>of(index);
+ return List.of(index);
}
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
index 69f5973a6d..07f17b3419 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
@@ -14,7 +14,7 @@
package org.apache.jackrabbit.oak.query.index;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
+
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
import static org.apache.jackrabbit.oak.api.Type.LONG;
@@ -37,8 +37,6 @@ import org.jetbrains.annotations.Nullable;
import org.junit.Ignore;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
/**
* Tests the query engine using the default index implementation: the
* {@link TraversingIndex}
@@ -71,7 +69,7 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
node.setProperty("jcr:mimeType", "text/plain");
root.commit();
assertQuery("//*[jcr:contains(., 'text/plain')]", "xpath",
- ImmutableList.of("/content"));
+ List.of("/content"));
}
@Test
@@ -83,10 +81,10 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
root.commit();
assertQuery("//*[jcr:contains(., 'testFullTextTermNameSimple')]",
"xpath",
- ImmutableList.of("/content/testFullTextTermNameSimple"));
+ List.of("/content/testFullTextTermNameSimple"));
assertQuery("//*[jcr:contains(., 'testFullTextTermNameFile.txt')]",
"xpath",
- ImmutableList.of("/content/testFullTextTermNameFile.txt"));
+ List.of("/content/testFullTextTermNameFile.txt"));
}
@Test
@@ -95,13 +93,13 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
c.addChild("one").setProperty("prop", "value");
c.addChild("two").setProperty("prop",
- ImmutableList.of("aaa", "value", "bbb"), Type.STRINGS);
+ List.of("aaa", "value", "bbb"), Type.STRINGS);
c.addChild("three").setProperty("prop",
- ImmutableList.of("aaa", "bbb", "ccc"), Type.STRINGS);
+ List.of("aaa", "bbb", "ccc"), Type.STRINGS);
root.commit();
assertQuery("//*[@prop != 'value']", "xpath",
- ImmutableList.of("/content/two", "/content/three"));
+ List.of("/content/two", "/content/three"));
}
@Test
@@ -110,13 +108,13 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
c.addChild("one").setProperty("prop", "aaa");
c.addChild("two").setProperty("prop",
- ImmutableList.of("aaa", "bbb", "ccc"), Type.STRINGS);
- c.addChild("three").setProperty("prop", ImmutableList.of("aaa", "bbb"),
+ List.of("aaa", "bbb", "ccc"), Type.STRINGS);
+ c.addChild("three").setProperty("prop", List.of("aaa", "bbb"),
Type.STRINGS);
root.commit();
assertQuery("//*[(@prop = 'aaa' and @prop = 'bbb' and @prop = 'ccc')]",
- "xpath", ImmutableList.of("/content/two"));
+ "xpath", List.of("/content/two"));
}
@Test
@@ -125,13 +123,13 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
c.addChild("one").setProperty("prop", "aaaBoom");
c.addChild("two").setProperty("prop",
- ImmutableList.of("aaaBoom", "bbbBoom", "cccBoom"), Type.STRINGS);
- c.addChild("three").setProperty("prop", ImmutableList.of("aaaBoom", "bbbBoom"),
+ List.of("aaaBoom", "bbbBoom", "cccBoom"), Type.STRINGS);
+ c.addChild("three").setProperty("prop", List.of("aaaBoom", "bbbBoom"),
Type.STRINGS);
root.commit();
assertQuery("//*[(jcr:like(@prop, 'aaa%') and jcr:like(@prop, 'bbb%') and jcr:like(@prop, 'ccc%'))]",
- "xpath", ImmutableList.of("/content/two"));
+ "xpath", List.of("/content/two"));
}
@Test
@@ -141,17 +139,17 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
c.addChild("one").addChild("child").setProperty("prop", "aaa");
c.addChild("two")
.addChild("child")
- .setProperty("prop", ImmutableList.of("aaa", "bbb", "ccc"),
+ .setProperty("prop", List.of("aaa", "bbb", "ccc"),
Type.STRINGS);
c.addChild("three")
.addChild("child")
- .setProperty("prop", ImmutableList.of("aaa", "bbb"),
+ .setProperty("prop", List.of("aaa", "bbb"),
Type.STRINGS);
root.commit();
assertQuery(
"//*[(child/@prop = 'aaa' and child/@prop = 'bbb' and child/@prop = 'ccc')]",
- "xpath", ImmutableList.of("/content/two"));
+ "xpath", List.of("/content/two"));
}
@Test
@@ -161,17 +159,17 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
c.addChild("one").addChild("child").setProperty("prop", "aaaBoom");
c.addChild("two")
.addChild("child")
- .setProperty("prop", ImmutableList.of("aaaBoom", "bbbBoom", "cccBoom"),
+ .setProperty("prop", List.of("aaaBoom", "bbbBoom", "cccBoom"),
Type.STRINGS);
c.addChild("three")
.addChild("child")
- .setProperty("prop", ImmutableList.of("aaaBoom", "bbbBoom"),
+ .setProperty("prop", List.of("aaaBoom", "bbbBoom"),
Type.STRINGS);
root.commit();
assertQuery(
"//*[(jcr:like(child/@prop, 'aaa%') and jcr:like(child/@prop, 'bbb%') and jcr:like(child/@prop, 'ccc%'))]",
- "xpath", ImmutableList.of("/content/two"));
+ "xpath", List.of("/content/two"));
}
@Test
@@ -204,8 +202,7 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
assertQuery(
"/jcr:root/home//*[@id='socialgraph_test_group']",
"xpath",
- ImmutableList
- .of("/home/users/testing/socialgraph_test_user_4/social/relationships/friend/socialgraph_test_group"));
+ List.of("/home/users/testing/socialgraph_test_user_4/social/relationships/friend/socialgraph_test_group"));
// sql2 select c.[jcr:path] as [jcr:path], c.[jcr:score] as [jcr:score],
// c.* from [nt:base] as a inner join [nt:base] as b on ischildnode(b,
@@ -217,8 +214,7 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
assertQuery(
"/jcr:root/home//social/relationships//*[@id='socialgraph_test_group']",
"xpath",
- ImmutableList
- .of("/home/users/testing/socialgraph_test_user_4/social/relationships/friend/socialgraph_test_group"));
+ List.of("/home/users/testing/socialgraph_test_user_4/social/relationships/friend/socialgraph_test_group"));
}
@@ -229,22 +225,22 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
root.commit();
assertQuery("//*[(@prop > 1)]", "xpath",
- ImmutableList.of("/content/node1"));
+ List.of("/content/node1"));
assertQuery("//*[(@prop > 2)]", "xpath",
- ImmutableList.of("/content/node1"));
+ List.of("/content/node1"));
assertQuery("//*[(@prop > 20)]", "xpath",
- ImmutableList.of("/content/node1"));
+ List.of("/content/node1"));
assertQuery("//*[(@prop > 100)]", "xpath",
- ImmutableList.of("/content/node1"));
+ List.of("/content/node1"));
assertQuery("//*[(@prop > 200)]", "xpath", new ArrayList<String>());
assertQuery("//*[(@prop > 1000)]", "xpath", new ArrayList<String>());
- assertQuery("//*[(*/@prop > 1)]", "xpath", ImmutableList.of("/content"));
- assertQuery("//*[(*/@prop > 2)]", "xpath", ImmutableList.of("/content"));
+ assertQuery("//*[(*/@prop > 1)]", "xpath", List.of("/content"));
+ assertQuery("//*[(*/@prop > 2)]", "xpath", List.of("/content"));
assertQuery("//*[(*/@prop > 20)]", "xpath",
- ImmutableList.of("/content"));
+ List.of("/content"));
assertQuery("//*[(*/@prop > 100)]", "xpath",
- ImmutableList.of("/content"));
+ List.of("/content"));
assertQuery("//*[(*/@prop > 200)]", "xpath", new ArrayList<String>());
assertQuery("//*[(*/@prop > 1000)]", "xpath", new ArrayList<String>());
}
@@ -271,35 +267,35 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
root.commit();
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 9)]", "xpath",
- ImmutableList.of("/content/nodes/a"));
+ List.of("/content/nodes/a"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 9)]",
- "xpath", ImmutableList.of("/content/nodes/a"));
+ "xpath", List.of("/content/nodes/a"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 10)]", "xpath",
- ImmutableList.of("/content/nodes/a"));
+ List.of("/content/nodes/a"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 10)]",
- "xpath", ImmutableList.of("/content/nodes/a"));
+ "xpath", List.of("/content/nodes/a"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 15)]", "xpath",
- ImmutableList.of("/content/nodes/a"));
+ List.of("/content/nodes/a"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 15)]",
- "xpath", ImmutableList.of("/content/nodes/a"));
+ "xpath", List.of("/content/nodes/a"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 20)]", "xpath",
- ImmutableList.of("/content/nodes/a"));
+ List.of("/content/nodes/a"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 20)]",
- "xpath", ImmutableList.of("/content/nodes/a"));
+ "xpath", List.of("/content/nodes/a"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 30)]", "xpath",
- ImmutableList.of("/content/nodes/a"));
+ List.of("/content/nodes/a"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 30)]",
- "xpath", ImmutableList.of("/content/nodes/a"));
+ "xpath", List.of("/content/nodes/a"));
}
/**
@@ -377,53 +373,53 @@ public class TraversingIndexQueryTest extends AbstractQueryTest {
root.commit();
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 9)]", "xpath",
- of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
+ List.of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
"/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 10)]", "xpath",
- of("/content/nodes/a10", "/content/nodes/a20", "/content/nodes/a30"));
+ List.of("/content/nodes/a10", "/content/nodes/a20", "/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 20)]", "xpath",
- of("/content/nodes/a20", "/content/nodes/a30"));
+ List.of("/content/nodes/a20", "/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 30)]", "xpath",
- of("/content/nodes/a30"));
+ List.of("/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop >= 40)]", "xpath", emptyList);
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop <= 8)]", "xpath", emptyList);
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop <= 9)]", "xpath",
- of("/content/nodes/a9"));
+ List.of("/content/nodes/a9"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop <= 10)]", "xpath",
- of("/content/nodes/a9", "/content/nodes/a10"));
+ List.of("/content/nodes/a9", "/content/nodes/a10"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop <= 20)]", "xpath",
- of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20"));
+ List.of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20"));
assertQuery("/jcr:root/content/nodes//*[(*/*/*/@prop <= 30)]", "xpath",
- of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
+ List.of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
"/content/nodes/a30"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 9)]",
"xpath",
- of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
+ List.of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
"/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 10)]",
- "xpath", of("/content/nodes/a10", "/content/nodes/a20", "/content/nodes/a30"));
+ "xpath", List.of("/content/nodes/a10", "/content/nodes/a20", "/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 20)]",
- "xpath", of("/content/nodes/a20", "/content/nodes/a30"));
+ "xpath", List.of("/content/nodes/a20", "/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 30)]",
- "xpath", of("/content/nodes/a30"));
+ "xpath", List.of("/content/nodes/a30"));
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop >= 40)]",
"xpath", emptyList);
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop <= 8)]",
"xpath", emptyList);
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop <= 9)]",
- "xpath", of("/content/nodes/a9"));
+ "xpath", List.of("/content/nodes/a9"));
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop <= 10)]",
- "xpath", of("/content/nodes/a9", "/content/nodes/a10"));
+ "xpath", List.of("/content/nodes/a9", "/content/nodes/a10"));
assertQuery("/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop <= 20)]",
- "xpath", of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20"));
+ "xpath", List.of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20"));
assertQuery(
"/jcr:root/content/nodes//element(*, nt:unstructured)[(*/*/*/@prop <= 30)]",
"xpath",
- of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
+ List.of("/content/nodes/a9", "/content/nodes/a10", "/content/nodes/a20",
"/content/nodes/a30"));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/stats/QuerySimilarCostTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/stats/QuerySimilarCostTest.java
index 63eb9fc195..8a479a197a 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/stats/QuerySimilarCostTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/stats/QuerySimilarCostTest.java
@@ -46,8 +46,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.slf4j.event.Level;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
/**
* Tests for cases where two or more indices return a similar cost estimation for the same query
*/
@@ -101,7 +99,7 @@ public class QuerySimilarCostTest extends AbstractQueryTest {
@Override
public @NotNull List<? extends QueryIndex> getQueryIndexes(NodeState nodeState) {
- return ImmutableList.<QueryIndex>of(index);
+ return List.of(index);
}
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationConfigurationImplOSGiTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationConfigurationImplOSGiTest.java
index ea224f0c09..c7308ec560 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationConfigurationImplOSGiTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationConfigurationImplOSGiTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.security.authorization.accesscontrol.AccessControlImporter;
@@ -101,13 +100,13 @@ public class AuthorizationConfigurationImplOSGiTest extends AbstractSecurityTest
@Test
public void testGetCommitHooks() {
- List<Class> expected = ImmutableList.of(VersionablePathHook.class, PermissionHook.class);
+ List<Class> expected = List.of(VersionablePathHook.class, PermissionHook.class);
assertTrue(Iterables.elementsEqual(expected, Iterables.transform(authorizationConfiguration.getCommitHooks(adminSession.getWorkspaceName()), commitHook -> commitHook.getClass())));
}
@Test
public void testGetValidators() {
- List<Class> expected = ImmutableList.of(PermissionStoreValidatorProvider.class, PermissionValidatorProvider.class, AccessControlValidatorProvider.class);
+ List<Class> expected = List.of(PermissionStoreValidatorProvider.class, PermissionValidatorProvider.class, AccessControlValidatorProvider.class);
assertTrue(Iterables.elementsEqual(expected, Iterables.transform(authorizationConfiguration.getValidators(adminSession.getWorkspaceName(), Set.of(), new MoveTracker()), commitHook -> commitHook.getClass())));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContextTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContextTest.java
index 306938e67f..526b88a087 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContextTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContextTest.java
@@ -22,7 +22,6 @@ import javax.jcr.RepositoryException;
import javax.jcr.security.AccessControlList;
import javax.jcr.security.AccessControlManager;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
@@ -127,7 +126,7 @@ public class AuthorizationContextTest extends AbstractSecurityTest {
assertTrue(ctx.definesLocation(TreeLocation.create(root, policyPath + "/allow/" + AccessControlConstants.REP_PRINCIPAL_NAME)));
assertTrue(ctx.definesLocation(TreeLocation.create(root, policyPath + "/allow/" + AccessControlConstants.REP_PRIVILEGES)));
- List<String> existingRegular = ImmutableList.of(
+ List<String> existingRegular = List.of(
"/",
"/jcr:system"
);
@@ -136,7 +135,7 @@ public class AuthorizationContextTest extends AbstractSecurityTest {
assertFalse(path, ctx.definesLocation(TreeLocation.create(root, PathUtils.concat(path, JcrConstants.JCR_PRIMARYTYPE))));
}
- List<String> nonExistingItem = ImmutableList.of(
+ List<String> nonExistingItem = List.of(
'/' + AccessControlConstants.REP_REPO_POLICY,
"/content/" + AccessControlConstants.REP_POLICY,
"/content/" + AccessControlConstants.REP_PRIVILEGES,
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACLTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACLTest.java
index 2bf3ceea6a..5fd8b8bab9 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACLTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACLTest.java
@@ -34,7 +34,6 @@ import javax.jcr.security.AccessControlEntry;
import javax.jcr.security.AccessControlException;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
@@ -114,7 +113,7 @@ public class ACLTest extends AbstractAccessControlTest implements PrivilegeConst
@Test
public void testGetNamePathMapper() {
assertSame(getNamePathMapper(), acl.getNamePathMapper());
- assertSame(NamePathMapper.DEFAULT, createACL(TEST_PATH, ImmutableList.of(), NamePathMapper.DEFAULT).getNamePathMapper());
+ assertSame(NamePathMapper.DEFAULT, createACL(TEST_PATH, List.of(), NamePathMapper.DEFAULT).getNamePathMapper());
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterAbortTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterAbortTest.java
index d4d689b80b..0d05bff559 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterAbortTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterAbortTest.java
@@ -18,7 +18,8 @@ package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
import javax.jcr.security.AccessControlException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import java.util.List;
+
import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
import org.junit.Test;
@@ -33,6 +34,6 @@ public class AccessControlImporterAbortTest extends AccessControlImporterBaseTes
public void testStartAceChildInfoUnknownPrincipal() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(unknownPrincipalInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(unknownPrincipalInfo));
}
}
\ No newline at end of file
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBaseTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBaseTest.java
index 02dfc26fdc..cc7fd70836 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBaseTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBaseTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
@@ -71,9 +70,9 @@ import static org.mockito.Mockito.withSettings;
public abstract class AccessControlImporterBaseTest extends AbstractSecurityTest implements AccessControlConstants {
- final NodeInfo aceGrantInfo = new NodeInfo("grantAceName", NT_REP_GRANT_ACE, ImmutableList.of(), null);
- private final NodeInfo aceDenyInfo = new NodeInfo("denyAceName", NT_REP_DENY_ACE, ImmutableList.of(), null);
- private final NodeInfo restrInfo = new NodeInfo("anyRestrName", NT_REP_RESTRICTIONS, ImmutableList.of(), null);
+ final NodeInfo aceGrantInfo = new NodeInfo("grantAceName", NT_REP_GRANT_ACE, List.of(), null);
+ private final NodeInfo aceDenyInfo = new NodeInfo("denyAceName", NT_REP_DENY_ACE, List.of(), null);
+ private final NodeInfo restrInfo = new NodeInfo("anyRestrName", NT_REP_RESTRICTIONS, List.of(), null);
final PropInfo unknownPrincipalInfo = new PropInfo(REP_PRINCIPAL_NAME, PropertyType.STRING, createTextValue("unknownPrincipal"));
private Tree accessControlledTree;
@@ -327,38 +326,38 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
@Test(expected = IllegalStateException.class)
public void testStartChildInfoNotInitialized() throws Exception {
- importer.startChildInfo(mock(NodeInfo.class), ImmutableList.of());
+ importer.startChildInfo(mock(NodeInfo.class), List.of());
}
@Test(expected = ConstraintViolationException.class)
public void testStartChildInfoUnknownType() throws Exception {
- NodeInfo invalidChildInfo = new NodeInfo("anyName", NT_OAK_UNSTRUCTURED, ImmutableList.of(), null);
+ NodeInfo invalidChildInfo = new NodeInfo("anyName", NT_OAK_UNSTRUCTURED, List.of(), null);
init();
importer.start(aclTree);
- importer.startChildInfo(invalidChildInfo, ImmutableList.of());
+ importer.startChildInfo(invalidChildInfo, List.of());
}
@Test(expected = ConstraintViolationException.class)
public void testStartNestedAceChildInfo() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of());
- importer.startChildInfo(aceDenyInfo, ImmutableList.of());
+ importer.startChildInfo(aceGrantInfo, List.of());
+ importer.startChildInfo(aceDenyInfo, List.of());
}
@Test(expected = ConstraintViolationException.class)
public void testStartRestrictionChildInfoWithoutAce() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(restrInfo, ImmutableList.of());
+ importer.startChildInfo(restrInfo, List.of());
}
@Test
public void testStartAceAndRestrictionChildInfo() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of());
- importer.startChildInfo(restrInfo, ImmutableList.of());
+ importer.startChildInfo(aceGrantInfo, List.of());
+ importer.startChildInfo(restrInfo, List.of());
}
@Test(expected = AccessControlException.class)
@@ -366,7 +365,7 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
init();
importer.start(aclTree);
PropInfo invalidPrivInfo = new PropInfo(REP_PRIVILEGES, PropertyType.NAME, createTextValues("jcr:invalidPrivilege"), PropInfo.MultipleStatus.MULTIPLE);
- importer.startChildInfo(aceDenyInfo, ImmutableList.of(invalidPrivInfo));
+ importer.startChildInfo(aceDenyInfo, List.of(invalidPrivInfo));
}
//-------------------------------------------------------< endChildInfo >---
@@ -387,7 +386,7 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
public void testEndChildInfoIncompleteAce() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of());
+ importer.startChildInfo(aceGrantInfo, List.of());
importer.endChildInfo();
}
@@ -418,10 +417,10 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
public void testInvalidRestriction() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(principalInfo, privInfo));
PropInfo invalidRestrProp = new PropInfo(REP_GLOB, PropertyType.NAME, createTextValues("glob1", "glob2"), PropInfo.MultipleStatus.MULTIPLE);
- importer.startChildInfo(restrInfo, ImmutableList.of(invalidRestrProp));
+ importer.startChildInfo(restrInfo, List.of(invalidRestrProp));
importer.endChildInfo();
importer.endChildInfo();
importer.end(aclTree);
@@ -431,10 +430,10 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
public void testUnknownRestriction() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(principalInfo, privInfo));
PropInfo invalidRestrProp = new PropInfo("unknown", PropertyType.STRING, createTextValue("val"));
- importer.startChildInfo(restrInfo, ImmutableList.of(invalidRestrProp));
+ importer.startChildInfo(restrInfo, List.of(invalidRestrProp));
importer.endChildInfo();
importer.endChildInfo();
importer.end(aclTree);
@@ -444,7 +443,7 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
public void testImportSimple() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(principalInfo, privInfo));
importer.endChildInfo();
importer.end(aclTree);
@@ -469,7 +468,7 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo, globInfo, ntNamesInfo, itemNamesInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(principalInfo, privInfo, globInfo, ntNamesInfo, itemNamesInfo));
importer.endChildInfo();
importer.end(aclTree);
@@ -487,8 +486,8 @@ public abstract class AccessControlImporterBaseTest extends AbstractSecurityTes
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(principalInfo, privInfo));
- importer.startChildInfo(restrInfo, ImmutableList.of(globInfo, ntNamesInfo, itemNamesInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(principalInfo, privInfo));
+ importer.startChildInfo(restrInfo, List.of(globInfo, ntNamesInfo, itemNamesInfo));
importer.endChildInfo();
importer.endChildInfo();
importer.end(aclTree);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBesteffortTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBesteffortTest.java
index cf08ac1038..77a725d169 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBesteffortTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterBesteffortTest.java
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
import javax.jcr.PropertyType;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
@@ -26,6 +25,8 @@ import org.apache.jackrabbit.oak.spi.xml.PropInfo;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
import org.junit.Test;
+import java.util.List;
+
import static org.junit.Assert.assertEquals;
public class AccessControlImporterBesteffortTest extends AccessControlImporterBaseTest{
@@ -39,7 +40,7 @@ public class AccessControlImporterBesteffortTest extends AccessControlImporterBa
public void testStartAceChildInfoUnknownPrincipal() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(unknownPrincipalInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(unknownPrincipalInfo));
}
@Test
@@ -48,7 +49,7 @@ public class AccessControlImporterBesteffortTest extends AccessControlImporterBa
importer.start(aclTree);
PropInfo privs = new PropInfo(REP_PRIVILEGES, PropertyType.NAME, createTextValues(PrivilegeConstants.JCR_READ));
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(unknownPrincipalInfo, privs));
+ importer.startChildInfo(aceGrantInfo, List.of(unknownPrincipalInfo, privs));
importer.endChildInfo();
importer.end(aclTree);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterIgnoreTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterIgnoreTest.java
index 3075ef731a..37cc4c5d92 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterIgnoreTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlImporterIgnoreTest.java
@@ -18,12 +18,13 @@ package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
import javax.jcr.PropertyType;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
import org.apache.jackrabbit.oak.spi.xml.PropInfo;
import org.junit.Test;
+import java.util.List;
+
import static org.junit.Assert.assertFalse;
public class AccessControlImporterIgnoreTest extends AccessControlImporterBaseTest{
@@ -37,7 +38,7 @@ public class AccessControlImporterIgnoreTest extends AccessControlImporterBaseTe
public void testStartAceChildInfoUnknownPrincipal() throws Exception {
init();
importer.start(aclTree);
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(unknownPrincipalInfo));
+ importer.startChildInfo(aceGrantInfo, List.of(unknownPrincipalInfo));
}
@Test
@@ -46,7 +47,7 @@ public class AccessControlImporterIgnoreTest extends AccessControlImporterBaseTe
importer.start(aclTree);
PropInfo privs = new PropInfo(REP_PRIVILEGES, PropertyType.NAME, createTextValues(PrivilegeConstants.JCR_READ));
- importer.startChildInfo(aceGrantInfo, ImmutableList.of(unknownPrincipalInfo, privs));
+ importer.startChildInfo(aceGrantInfo, List.of(unknownPrincipalInfo, privs));
importer.endChildInfo();
importer.end(aclTree);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerImplTest.java
index 3d4a7e05b3..f276daff1d 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerImplTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
@@ -641,7 +640,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
@Test
public void testGetApplicablePoliciesOnAccessControllable() throws Exception {
Tree node = root.getTree(testPath);
- node.setProperty(JcrConstants.JCR_MIXINTYPES, ImmutableList.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
+ node.setProperty(JcrConstants.JCR_MIXINTYPES, List.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
@@ -784,7 +783,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
Tree aclNode = root.getTree(testPath + '/' + REP_POLICY);
Tree aceNode = TreeUtil.addChild(aclNode, "testACE", NT_REP_DENY_ACE);
aceNode.setProperty(REP_PRINCIPAL_NAME, "invalidPrincipal");
- aceNode.setProperty(REP_PRIVILEGES, ImmutableList.of(PrivilegeConstants.JCR_READ), Type.NAMES);
+ aceNode.setProperty(REP_PRIVILEGES, List.of(PrivilegeConstants.JCR_READ), Type.NAMES);
// reading policies with unknown principal name should not fail.
AccessControlPolicy[] policies = acMgr.getPolicies(testPath);
@@ -1485,7 +1484,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
@Test
public void testGetApplicablePoliciesByPrincipal() throws Exception {
- List<Principal> principals = ImmutableList.of(testPrincipal, EveryonePrincipal.getInstance());
+ List<Principal> principals = List.of(testPrincipal, EveryonePrincipal.getInstance());
for (Principal principal : principals) {
AccessControlPolicy[] applicable = acMgr.getApplicablePolicies(principal);
assertPolicies(applicable, 1);
@@ -1515,7 +1514,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
@Test
public void testGetPoliciesByPrincipal() throws Exception {
- List<Principal> principals = ImmutableList.of(testPrincipal, EveryonePrincipal.getInstance());
+ List<Principal> principals = List.of(testPrincipal, EveryonePrincipal.getInstance());
for (Principal principal : principals) {
assertPolicies(acMgr.getPolicies(principal), 0);
}
@@ -1718,7 +1717,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
// different ways to create the principal-set to make sure the filtering
// doesn't rely on principal equality but rather on the name.
- List<Principal> principals = ImmutableList.of(
+ List<Principal> principals = List.of(
testPrincipal,
new PrincipalImpl(testPrincipal.getName()),
() -> testPrincipal.getName());
@@ -1745,7 +1744,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
Tree testTree = r.getTree(testPath);
Tree ace = TreeUtil.addChild(testTree, "ace", NT_REP_GRANT_ACE);
ace.setProperty(REP_PRINCIPAL_NAME, testPrincipal.getName());
- ace.setProperty(REP_PRIVILEGES, ImmutableList.of(JCR_READ), Type.NAMES);
+ ace.setProperty(REP_PRIVILEGES, List.of(JCR_READ), Type.NAMES);
QueryEngine qe = mockQueryEngine(ace);
when(r.getQueryEngine()).thenReturn(qe);
@@ -1765,7 +1764,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
Tree aclWithWrongType = TreeUtil.addChild(testTree, REP_POLICY, NT_OAK_UNSTRUCTURED);
Tree ace = TreeUtil.addChild(aclWithWrongType, "ace", NT_REP_GRANT_ACE);
ace.setProperty(REP_PRINCIPAL_NAME, testPrincipal.getName());
- ace.setProperty(REP_PRIVILEGES, ImmutableList.of(JCR_READ), Type.NAMES);
+ ace.setProperty(REP_PRIVILEGES, List.of(JCR_READ), Type.NAMES);
QueryEngine qe = mockQueryEngine(ace);
when(r.getQueryEngine()).thenReturn(qe);
@@ -1777,7 +1776,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
private static QueryEngine mockQueryEngine(@NotNull Tree aceTree) throws Exception {
ResultRow row = when(mock(ResultRow.class).getTree(null)).thenReturn(aceTree).getMock();
- Iterable rows = ImmutableList.of(row);
+ Iterable rows = List.of(row);
Result res = mock(Result.class);
when(res.getRows()).thenReturn(rows).getMock();
QueryEngine qe = mock(QueryEngine.class);
@@ -1794,7 +1793,7 @@ public class AccessControlManagerImplTest extends AbstractAccessControlTest impl
Tree testTree = r.getTree(testPath);
Tree ace = TreeUtil.addChild(testTree, "ace", NT_REP_GRANT_ACE);
ace.setProperty(REP_PRINCIPAL_NAME, testPrincipal.getName());
- ace.setProperty(REP_PRIVILEGES, ImmutableList.of(JCR_READ), Type.NAMES);
+ ace.setProperty(REP_PRIVILEGES, List.of(JCR_READ), Type.NAMES);
QueryEngine qe = mock(QueryEngine.class);
when(qe.executeQuery(anyString(), anyString(), any(Map.class), any(Map.class))).thenThrow(new ParseException("test", 0));
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerLimitedPermissionsTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerLimitedPermissionsTest.java
index 55c3ea3d92..106fdb2a68 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerLimitedPermissionsTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlManagerLimitedPermissionsTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
@@ -338,7 +337,7 @@ public class AccessControlManagerLimitedPermissionsTest extends AbstractSecurity
root.commit();
testRoot.refresh();
- List<Principal> principals = ImmutableList.of(testPrincipal, EveryonePrincipal.getInstance());
+ List<Principal> principals = List.of(testPrincipal, EveryonePrincipal.getInstance());
for (Principal principal : principals) {
// testRoot can't read access control content -> doesn't see
// the existing policies and creates a new applicable policy.
@@ -358,7 +357,7 @@ public class AccessControlManagerLimitedPermissionsTest extends AbstractSecurity
testRoot.refresh();
PrincipalManager testPrincipalMgr = getPrincipalManager(testRoot);
- List<Principal> principals = ImmutableList.of(testPrincipal, EveryonePrincipal.getInstance());
+ List<Principal> principals = List.of(testPrincipal, EveryonePrincipal.getInstance());
for (Principal principal : principals) {
if (testPrincipalMgr.hasPrincipal(principal.getName())) {
// testRoot can't read access control content -> doesn't see
@@ -418,7 +417,7 @@ public class AccessControlManagerLimitedPermissionsTest extends AbstractSecurity
testRoot.refresh();
- List<String> paths = ImmutableList.of(testPath, NodeTypeConstants.NODE_TYPES_PATH);
+ List<String> paths = List.of(testPath, NodeTypeConstants.NODE_TYPES_PATH);
for (String path : paths) {
assertFalse(testAcMgr.hasPrivileges(path, privilegesFromNames(PrivilegeConstants.JCR_READ_ACCESS_CONTROL)));
try {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlValidatorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlValidatorTest.java
index 221488a86c..50d72c9016 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlValidatorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/AccessControlValidatorTest.java
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
@@ -63,7 +61,9 @@ import javax.jcr.Value;
import javax.jcr.ValueFactory;
import javax.jcr.security.AccessControlManager;
import java.security.Principal;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -148,7 +148,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
@NotNull
private Tree createPolicy(@NotNull Tree tree, boolean createRestrictionNode) throws AccessDeniedException {
- tree.setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
+ tree.setProperty(JCR_MIXINTYPES, List.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
Tree acl = TreeUtil.addChild(tree, REP_POLICY, NT_REP_ACL);
acl.setOrderableChildren(true);
@@ -163,7 +163,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
private static Tree createACE(@NotNull Tree acl, @NotNull String aceName, @NotNull String ntName, @NotNull String principalName, @NotNull String... privilegeNames) throws AccessDeniedException {
Tree ace = TreeUtil.addChild(acl, aceName, ntName);
ace.setProperty(REP_PRINCIPAL_NAME, principalName);
- ace.setProperty(REP_PRIVILEGES, ImmutableList.copyOf(privilegeNames), Type.NAMES);
+ ace.setProperty(REP_PRIVILEGES, Arrays.asList(privilegeNames), Type.NAMES);
return ace;
}
@@ -176,7 +176,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
@Test(expected = CommitFailedException.class)
public void testPolicyWithOutChildOrder() throws Exception {
Tree testRoot = getTestTree();
- testRoot.setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
+ testRoot.setProperty(JCR_MIXINTYPES, List.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
TreeUtil.addChild(testRoot, REP_POLICY, NT_REP_ACL);
try {
@@ -189,7 +189,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
@Test(expected = CommitFailedException.class)
public void testOnlyRootIsRepoAccessControllable() throws Exception {
Tree testRoot = getTestTree();
- testRoot.setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REP_REPO_ACCESS_CONTROLLABLE), Type.NAMES);
+ testRoot.setProperty(JCR_MIXINTYPES, List.of(MIX_REP_REPO_ACCESS_CONTROLLABLE), Type.NAMES);
try {
root.commit();
@@ -201,7 +201,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
@Test(expected = CommitFailedException.class)
public void testAddInvalidRepoPolicy() throws Exception {
Tree testRoot = getTestTree();
- testRoot.setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
+ testRoot.setProperty(JCR_MIXINTYPES, List.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
TreeUtil.addChild(testRoot, REP_REPO_POLICY, NT_REP_ACL);
try {
root.commit();
@@ -439,7 +439,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
Tree ace = createDuplicateAceTree();
Tree rest = TreeUtil.addChild(ace, REP_RESTRICTIONS, NT_REP_RESTRICTIONS);
rest.setProperty(AccessControlConstants.REP_GLOB, "some/glob", Type.STRING);
- rest.setProperty(AccessControlConstants.REP_GLOBS, ImmutableList.of("glob1", "glob2"), Type.STRINGS);
+ rest.setProperty(AccessControlConstants.REP_GLOBS, List.of("glob1", "glob2"), Type.STRINGS);
try {
root.commit();
@@ -455,7 +455,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
Tree policy = root.getTree(testPath + "/rep:policy");
Tree ace = TreeUtil.addChild(policy, "duplicateAce", NT_REP_GRANT_ACE);
ace.setProperty(REP_PRINCIPAL_NAME, testPrincipal.getName());
- ace.setProperty(AccessControlConstants.REP_PRIVILEGES, ImmutableList.of(PrivilegeConstants.JCR_ADD_CHILD_NODES), Type.NAMES);
+ ace.setProperty(AccessControlConstants.REP_PRIVILEGES, List.of(PrivilegeConstants.JCR_ADD_CHILD_NODES), Type.NAMES);
return ace;
}
@@ -606,7 +606,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
@Test(expected = CommitFailedException.class)
public void testAddPolicyTreeWithInvalidName() throws Exception {
Tree rootTree = root.getTree(PathUtils.ROOT_PATH);
- rootTree.setProperty(JCR_MIXINTYPES, ImmutableList.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
+ rootTree.setProperty(JCR_MIXINTYPES, List.of(MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES);
TreeUtil.addChild(rootTree, "invalidName", NT_REP_ACL);
Validator v = createRootValidator(rootTree);
@@ -622,7 +622,7 @@ public class AccessControlValidatorTest extends AbstractSecurityTest implements
Tree rootTree = root.getTree(PathUtils.ROOT_PATH);
Tree policy = createPolicy(rootTree, false);
Tree entry = policy.getChild(aceName);
- entry.setProperty(REP_PRIVILEGES, ImmutableList.of(), Type.NAMES);
+ entry.setProperty(REP_PRIVILEGES, List.of(), Type.NAMES);
Validator v = createRootValidator(rootTree);
try {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/RemappedPrivilegeNamesTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/RemappedPrivilegeNamesTest.java
index b65918f975..ea60f63ddf 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/RemappedPrivilegeNamesTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/RemappedPrivilegeNamesTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.accesscontrol;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
@@ -90,6 +89,6 @@ public class RemappedPrivilegeNamesTest extends AbstractAccessControlTest {
getAccessControlManager(root).setPolicy(acl.getPath(), acl);
Tree aceTree = root.getTree(acl.getPath()).getChild(REP_POLICY).getChildren().iterator().next();
Iterable<String> privNames = TreeUtil.getNames(aceTree, PrivilegeConstants.REP_PRIVILEGES);
- assertTrue(Iterables.elementsEqual(ImmutableList.of(PrivilegeConstants.JCR_READ), privNames));
+ assertTrue(Iterables.elementsEqual(List.of(PrivilegeConstants.JCR_READ), privNames));
}
}
\ No newline at end of file
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/AbstractCompositeProviderTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/AbstractCompositeProviderTest.java
index d3a49d8731..3c551709c2 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/AbstractCompositeProviderTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/AbstractCompositeProviderTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.composite;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
@@ -46,6 +45,7 @@ import org.junit.Test;
import javax.jcr.Session;
import javax.jcr.security.AccessControlManager;
import java.security.Principal;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -69,8 +69,8 @@ public abstract class AbstractCompositeProviderTest extends AbstractSecurityTest
static final String TEST_PATH_2 = "/test2";
- static final List<String> NODE_PATHS = ImmutableList.of(ROOT_PATH, TEST_PATH, TEST_PATH_2, TEST_CHILD_PATH, TEST_A_PATH, TEST_A_B_PATH, TEST_A_B_C_PATH, TEST_A_B2_PATH);
- static final List<String> TP_PATHS = ImmutableList.of(ROOT_PATH, TEST_PATH, TEST_A_PATH, TEST_A_B_PATH, TEST_A_B_C_PATH, TEST_A_B_C_PATH + "/nonexisting");
+ static final List<String> NODE_PATHS = List.of(ROOT_PATH, TEST_PATH, TEST_PATH_2, TEST_CHILD_PATH, TEST_A_PATH, TEST_A_B_PATH, TEST_A_B_C_PATH, TEST_A_B2_PATH);
+ static final List<String> TP_PATHS = List.of(ROOT_PATH, TEST_PATH, TEST_A_PATH, TEST_A_B_PATH, TEST_A_B_C_PATH, TEST_A_B_C_PATH + "/nonexisting");
static final PropertyState PROPERTY_STATE = PropertyStates.createProperty("propName", "val");
@@ -238,14 +238,13 @@ public abstract class AbstractCompositeProviderTest extends AbstractSecurityTest
List<AggregatedPermissionProvider> getAggregatedProviders(@NotNull String workspaceName,
@NotNull AuthorizationConfiguration config,
@NotNull Set<Principal> principals) {
- ImmutableList<AggregatedPermissionProvider> l = ImmutableList.of(
+ List<AggregatedPermissionProvider> l = new ArrayList<>(List.of(
(AggregatedPermissionProvider) config.getPermissionProvider(root, workspaceName, principals),
- getTestPermissionProvider());
+ getTestPermissionProvider()));
if (reverseOrder()) {
- return l.reverse();
- } else {
- return l;
+ Collections.reverse(l);
}
+ return l;
}
CompositePermissionProvider createPermissionProvider(Principal... principals) {
@@ -572,7 +571,7 @@ public abstract class AbstractCompositeProviderTest extends AbstractSecurityTest
@Test
public void testTreePermissionGetChild() throws Exception {
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = getTreeProvider().asNodeState(rootTree);
@@ -587,7 +586,7 @@ public abstract class AbstractCompositeProviderTest extends AbstractSecurityTest
@Test
public void testTreePermissionGetChildOR() throws Exception {
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = getTreeProvider().asNodeState(rootTree);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeAccessControlManagerTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeAccessControlManagerTest.java
index 3b90bdb869..3b572906f6 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeAccessControlManagerTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeAccessControlManagerTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.composite;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
@@ -44,6 +43,7 @@ import javax.jcr.security.AccessControlPolicy;
import javax.jcr.security.AccessControlPolicyIterator;
import javax.jcr.security.Privilege;
import java.security.Principal;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
@@ -100,7 +100,7 @@ public class CompositeAccessControlManagerTest extends AbstractSecurityTest {
@NotNull
private CompositeAccessControlManager createComposite(@NotNull AggregationFilter aggregationFilter, @NotNull AccessControlManager... acMgrs) {
- return new CompositeAccessControlManager(root, NamePathMapper.DEFAULT, getSecurityProvider(), ImmutableList.copyOf(acMgrs), aggregationFilter);
+ return new CompositeAccessControlManager(root, NamePathMapper.DEFAULT, getSecurityProvider(), Arrays.asList(acMgrs), aggregationFilter);
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositePermissionProviderOrTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositePermissionProviderOrTest.java
index 28951c63d4..11fbf672a5 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositePermissionProviderOrTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositePermissionProviderOrTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.composite;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Root;
@@ -98,7 +97,7 @@ public class CompositePermissionProviderOrTest extends AbstractSecurityTest {
String workspaceName = root.getContentSession().getWorkspaceName();
AuthorizationConfiguration config = getConfig(AuthorizationConfiguration.class);
- ImmutableList<AggregatedPermissionProvider> l = ImmutableList.of(
+ List<AggregatedPermissionProvider> l = List.of(
(AggregatedPermissionProvider) config.getPermissionProvider(root, workspaceName, principals),
new ReadNodeGrantedInSupportedTree());
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCoverageTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCoverageTest.java
index 601deece30..6883858d48 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCoverageTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCoverageTest.java
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Set;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -79,7 +78,7 @@ public class CompositeProviderCoverageTest extends AbstractCompositeProviderTest
@Override
List<AggregatedPermissionProvider> getAggregatedProviders(@NotNull String workspaceName, @NotNull AuthorizationConfiguration config, @NotNull Set<Principal> principals) {
- return ImmutableList.of(getTestPermissionProvider());
+ return List.of(getTestPermissionProvider());
}
@Override
@@ -111,7 +110,7 @@ public class CompositeProviderCoverageTest extends AbstractCompositeProviderTest
@Override
@Test
public void testTreePermissionGetChild() throws Exception {
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = getTreeProvider().asNodeState(rootTree);
@@ -127,7 +126,7 @@ public class CompositeProviderCoverageTest extends AbstractCompositeProviderTest
@Override
@Test
public void testTreePermissionGetChildOR() throws Exception {
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = getTreeProvider().asNodeState(rootTree);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCustomMixTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCustomMixTest.java
index 6407a51677..4931748367 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCustomMixTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderCustomMixTest.java
@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+
import org.apache.jackrabbit.guava.common.collect.Sets;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
@@ -232,7 +232,7 @@ public class CompositeProviderCustomMixTest extends AbstractSecurityTest {
AggregatedPermissionProvider a2 = new CustomProvider(root, supported2, granted2, grantMap);
AuthorizationConfiguration config = getConfig(AuthorizationConfiguration.class);
- List<AggregatedPermissionProvider> composite = ImmutableList.of(a1, a2);
+ List<AggregatedPermissionProvider> composite = List.of(a1, a2);
return CompositePermissionProvider.create(root, composite, config.getContext(), type, getRootProvider(), getTreeProvider());
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderFullScopeTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderFullScopeTest.java
index ead95d6ab8..a47cd60d61 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderFullScopeTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderFullScopeTest.java
@@ -16,13 +16,13 @@
*/
package org.apache.jackrabbit.oak.security.authorization.composite;
+import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -226,7 +226,7 @@ public class CompositeProviderFullScopeTest extends AbstractCompositeProviderTes
for (String p : defActionsGranted.keySet()) {
String[] actions = defActionsGranted.get(p);
- if (ImmutableList.copyOf(actions).contains(Session.ACTION_READ)) {
+ if (Arrays.asList(actions).contains(Session.ACTION_READ)) {
TreeLocation tl = TreeLocation.create(readOnlyRoot, p);
assertEquals(p, tl.getTree() != null, cppTestUser.isGranted(p, Session.ACTION_READ));
} else {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderGetTreePermissionTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderGetTreePermissionTest.java
index 001bc1993b..e326e7486d 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderGetTreePermissionTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderGetTreePermissionTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.composite;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Tree;
@@ -31,6 +30,8 @@ import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
+import java.util.Arrays;
+
import static org.apache.jackrabbit.oak.security.authorization.composite.CompositeAuthorizationConfiguration.CompositionType.AND;
import static org.apache.jackrabbit.oak.security.authorization.composite.CompositeAuthorizationConfiguration.CompositionType.OR;
import static org.junit.Assert.assertSame;
@@ -47,7 +48,7 @@ public class CompositeProviderGetTreePermissionTest extends AbstractSecurityTest
private CompositePermissionProvider createProvider(@NotNull CompositeAuthorizationConfiguration.CompositionType compositionType,
@NotNull AggregatedPermissionProvider... providers) {
- return CompositePermissionProvider.create(root, ImmutableList.copyOf(providers), Context.DEFAULT, compositionType, getRootProvider(), getTreeProvider());
+ return CompositePermissionProvider.create(root, Arrays.asList(providers), Context.DEFAULT, compositionType, getRootProvider(), getTreeProvider());
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderNoScopeTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderNoScopeTest.java
index 5e71f87e76..def4c75b67 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderNoScopeTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderNoScopeTest.java
@@ -24,7 +24,6 @@ import java.util.Map;
import java.util.Set;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.api.ContentSession;
import org.apache.jackrabbit.oak.api.Tree;
@@ -119,7 +118,7 @@ public class CompositeProviderNoScopeTest extends AbstractCompositeProviderTest
@Override
@Test
public void testTreePermissionGetChild() {
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = getTreeProvider().asNodeState(rootTree);
@@ -136,7 +135,7 @@ public class CompositeProviderNoScopeTest extends AbstractCompositeProviderTest
@Override
@Test
public void testTreePermissionGetChildOR() {
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = getTreeProvider().asNodeState(rootTree);
@@ -453,7 +452,7 @@ public class CompositeProviderNoScopeTest extends AbstractCompositeProviderTest
TreePermission tp = cppTestUser.getTreePermission(rootTree, TreePermission.EMPTY);
assertEquals(2, ((TreePermission[]) tpField.get(tp)).length);
- List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
+ List<String> childNames = List.of("test", "a", "b", "c", "nonexisting");
for (String cName : childNames) {
ns = ns.getChildNode(cName);
tp = tp.getChildPermission(cName, ns);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderScopeTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderScopeTest.java
index 69f1518d3a..1cdb7c7800 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderScopeTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderScopeTest.java
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.Set;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -72,7 +71,7 @@ import static org.junit.Assert.assertTrue;
*/
public class CompositeProviderScopeTest extends AbstractCompositeProviderTest {
- private static List<String> PATH_OUTSIDE_SCOPE = ImmutableList.of(ROOT_PATH, TEST_PATH, TEST_CHILD_PATH);
+ private static List<String> PATH_OUTSIDE_SCOPE = List.of(ROOT_PATH, TEST_PATH, TEST_CHILD_PATH);
private CompositePermissionProvider cppTestUser;
private CompositePermissionProvider cppAdminUser;
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderSupportedTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderSupportedTest.java
index e3db40fd88..4100e4ecc9 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderSupportedTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/CompositeProviderSupportedTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.jackrabbit.oak.security.authorization.composite;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import java.util.Arrays;
+
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -89,7 +90,7 @@ public class CompositeProviderSupportedTest extends AbstractSecurityTest {
}
private CompositePermissionProvider createProvider(@NotNull CompositeAuthorizationConfiguration.CompositionType compositionType, @NotNull AggregatedPermissionProvider... aggregated) {
- return CompositePermissionProvider.create(root, ImmutableList.copyOf(aggregated), Context.DEFAULT, compositionType, getRootProvider(), getTreeProvider());
+ return CompositePermissionProvider.create(root, Arrays.asList(aggregated), Context.DEFAULT, compositionType, getRootProvider(), getTreeProvider());
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java
index f017dcf4d0..d53620e243 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -98,7 +97,7 @@ public class ChildOrderPropertyTest extends AbstractOakCoreTest {
// verify that properties cannot be read:
assertFalse(aTree.hasProperty(JcrConstants.JCR_PRIMARYTYPE));
- List<String> expected = ImmutableList.of("/a/bb", "/a/b");
+ List<String> expected = List.of("/a/bb", "/a/b");
Iterable<String> childPaths = Iterables.transform(aTree.getChildren(), input -> input.getPath());
assertTrue(childPaths.toString(), Iterables.elementsEqual(expected, childPaths));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/RootTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/RootTest.java
index 3b2cb05b14..fee48b3b4c 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/RootTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/RootTest.java
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.security.authorization.evaluation;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Root;
@@ -44,7 +43,7 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> accessible = ImmutableList.of("/", "/a", "/a/b", "/a/b/c");
+ List<String> accessible = List.of("/", "/a", "/a/b", "/a/b/c");
for (String path : accessible) {
assertTrue(testRoot.getTree(path).exists());
}
@@ -60,12 +59,12 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> notAccessible = ImmutableList.of("/", "/a/b");
+ List<String> notAccessible = List.of("/", "/a/b");
for (String path : notAccessible) {
assertFalse(path, testRoot.getTree(path).exists());
}
- List<String> accessible = ImmutableList.of("/a", "/a/bb", "/a/b/c");
+ List<String> accessible = List.of("/a", "/a/bb", "/a/b/c");
for (String path : accessible) {
assertTrue(path, testRoot.getTree(path).exists());
}
@@ -79,7 +78,7 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> accessible = ImmutableList.of("/", "/a", "/a/b", "/a/b/c");
+ List<String> accessible = List.of("/", "/a", "/a/b", "/a/b/c");
for (String path : accessible) {
Tree tree = testRoot.getTree(path);
assertNotNull(tree);
@@ -99,14 +98,14 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> notAccessible = ImmutableList.of("/", "/a/b");
+ List<String> notAccessible = List.of("/", "/a/b");
for (String path : notAccessible) {
Tree tree = testRoot.getTree(path);
assertNotNull(path, tree);
assertFalse(tree.exists());
}
- List<String> accessible = ImmutableList.of("/a", "/a/bb", "/a/b/c");
+ List<String> accessible = List.of("/a", "/a/bb", "/a/b/c");
for (String path : accessible) {
Tree tree = testRoot.getTree(path);
assertNotNull(path, tree);
@@ -121,7 +120,7 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> notAccessible = ImmutableList.of("/", "/a", "/a/b", "/a/bb", "/a/b/c");
+ List<String> notAccessible = List.of("/", "/a", "/a/b", "/a/bb", "/a/b/c");
for (String path : notAccessible) {
Tree tree = testRoot.getTree(path);
assertNotNull(path, tree);
@@ -135,14 +134,14 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> accessible = ImmutableList.of("/", "/a", "/a/b", "/a/bb", "/a/b/c");
+ List<String> accessible = List.of("/", "/a", "/a/b", "/a/bb", "/a/b/c");
for (String path : accessible) {
String propertyPath = PathUtils.concat(path, JcrConstants.JCR_PRIMARYTYPE);
PropertyState property = testRoot.getTree(path).getProperty(JcrConstants.JCR_PRIMARYTYPE);
assertNotNull(propertyPath, property);
}
- List<String> propPaths = ImmutableList.of("/a/aProp", "/a/b/bProp", "/a/bb/bbProp", "/a/b/c/cProp");
+ List<String> propPaths = List.of("/a/aProp", "/a/b/bProp", "/a/bb/bbProp", "/a/b/c/cProp");
for (String path : propPaths) {
PropertyState property = testRoot.getTree(PathUtils.getParentPath(path)).getProperty(PathUtils.getName(path));
assertNotNull(path, property);
@@ -155,14 +154,14 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> accessible = ImmutableList.of("/", "/a", "/a/b", "/a/bb", "/a/b/c");
+ List<String> accessible = List.of("/", "/a", "/a/b", "/a/bb", "/a/b/c");
for (String path : accessible) {
String propertyPath = PathUtils.concat(path, JcrConstants.JCR_PRIMARYTYPE);
PropertyState property = testRoot.getTree(path).getProperty(JcrConstants.JCR_PRIMARYTYPE);
assertNotNull(propertyPath, property);
}
- List<String> propPaths = ImmutableList.of("/a/aProp", "/a/b/bProp", "/a/bb/bbProp", "/a/b/c/cProp");
+ List<String> propPaths = List.of("/a/aProp", "/a/b/bProp", "/a/bb/bbProp", "/a/b/c/cProp");
for (String path : propPaths) {
PropertyState property = testRoot.getTree(PathUtils.getParentPath(path)).getProperty(PathUtils.getName(path));
assertNotNull(path, property);
@@ -177,13 +176,13 @@ public class RootTest extends AbstractOakCoreTest {
Root testRoot = getTestRoot();
- List<String> accessible = ImmutableList.of("/a/aProp", "/a/bb/bbProp", "/a/b/c/cProp");
+ List<String> accessible = List.of("/a/aProp", "/a/bb/bbProp", "/a/b/c/cProp");
for (String path : accessible) {
PropertyState property = testRoot.getTree(PathUtils.getParentPath(path)).getProperty(PathUtils.getName(path));
assertNotNull(path, property);
}
- List<String> notAccessible = ImmutableList.of("/jcr:primaryType", "/a/b/bProp");
+ List<String> notAccessible = List.of("/jcr:primaryType", "/a/b/bProp");
for (String path : notAccessible) {
PropertyState property = testRoot.getTree(PathUtils.getParentPath(path)).getProperty(PathUtils.getName(path));
assertNull(path, property);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java
index b7e2b7a03f..893eef1b53 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.fail;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Root;
@@ -101,7 +100,7 @@ public class TreeTest extends AbstractOakCoreTest {
assertEquals(cntA - 1, testRoot.getTree("/a").getChildrenCount(Long.MAX_VALUE));
// for the following nodes the cnt must not differ
- List<String> paths = ImmutableList.of("/a/b", "/a/b/c");
+ List<String> paths = List.of("/a/b", "/a/b/c");
for (String path : paths) {
assertEquals(
root.getTree(path).getChildrenCount(Long.MAX_VALUE),
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ChildOrderDiffTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ChildOrderDiffTest.java
index 0db13cbfbb..c83a187164 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ChildOrderDiffTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ChildOrderDiffTest.java
@@ -16,13 +16,14 @@
*/
package org.apache.jackrabbit.oak.security.authorization.permission;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
+import java.util.Arrays;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -30,7 +31,7 @@ public class ChildOrderDiffTest {
@NotNull
private static PropertyState createPropertyState(@NotNull String... names) {
- return PropertyStates.createProperty("any", ImmutableList.copyOf(names), Type.NAMES);
+ return PropertyStates.createProperty("any", Arrays.asList(names), Type.NAMES);
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorTest.java
index ab97d1076d..77e3316bf9 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.permission;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
@@ -47,6 +46,7 @@ import org.junit.Test;
import javax.jcr.security.AccessControlManager;
import java.security.Principal;
+import java.util.List;
import java.util.Set;
import static org.apache.jackrabbit.JcrConstants.JCR_CREATED;
@@ -276,7 +276,7 @@ public class PermissionValidatorTest extends AbstractSecurityTest {
Root testRoot = testSession.getLatestRoot();
Tree testChild = testRoot.getTree(TEST_CHILD_PATH);
- testChild.setProperty(PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, ImmutableList.of(AccessControlConstants.MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES));
+ testChild.setProperty(PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, List.of(AccessControlConstants.MIX_REP_ACCESS_CONTROLLABLE), Type.NAMES));
Tree testPolicy = testChild.getChild(AccessControlConstants.REP_POLICY);
testPolicy.setOrderableChildren(true);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/VersionablePathHookTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/VersionablePathHookTest.java
index 22ad256a77..92f68bbfec 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/VersionablePathHookTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/VersionablePathHookTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.permission;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -36,6 +35,7 @@ import org.junit.Before;
import org.junit.Test;
import java.util.Collections;
+import java.util.List;
import static org.apache.jackrabbit.JcrConstants.JCR_UUID;
import static org.apache.jackrabbit.JcrConstants.JCR_VERSIONHISTORY;
@@ -76,7 +76,7 @@ public class VersionablePathHookTest extends AbstractSecurityTest {
@Override
public @NotNull Iterable<? extends PropertyState> getProperties() {
- return ImmutableList.of(PropertyStates.createProperty(JCR_VERSIONHISTORY, "someValue"));
+ return List.of(PropertyStates.createProperty(JCR_VERSIONHISTORY, "someValue"));
}
@Override
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CompositeRestrictionProviderTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CompositeRestrictionProviderTest.java
index 1ad0fa9ae4..b9354bf2a2 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CompositeRestrictionProviderTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CompositeRestrictionProviderTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.restriction;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
@@ -37,6 +36,7 @@ import javax.jcr.PropertyType;
import javax.jcr.ValueFactory;
import javax.jcr.security.AccessControlException;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -92,11 +92,11 @@ public class CompositeRestrictionProviderTest extends AbstractSecurityTest imple
public void testReadRestrictions() throws Exception {
Tree aceNode = TreeUtil.addChild(root.getTree("/"), "test", NT_REP_GRANT_ACE);
aceNode.setProperty("boolean", true);
- aceNode.setProperty(PropertyStates.createProperty("longs", ImmutableList.of(vf.createValue(10), vf.createValue(290))));
+ aceNode.setProperty(PropertyStates.createProperty("longs", List.of(vf.createValue(10), vf.createValue(290))));
aceNode.setProperty(REP_GLOB, "*");
aceNode.setProperty(REP_NT_NAMES, Set.of(), Type.NAMES); // empty array
aceNode.setProperty("invalid", "val");
- aceNode.setProperty("invalid2", ImmutableList.of("val1", "val2", "val3"), Type.STRINGS);
+ aceNode.setProperty("invalid2", List.of("val1", "val2", "val3"), Type.STRINGS);
Set<Restriction> restrictions = provider.readRestrictions("/test", aceNode);
assertEquals(4, restrictions.size());
@@ -136,9 +136,9 @@ public class CompositeRestrictionProviderTest extends AbstractSecurityTest imple
Tree aceNode = TreeUtil.addChild(root.getTree("/"), "test", NT_REP_GRANT_ACE);
Tree rNode = TreeUtil.addChild(aceNode, REP_RESTRICTIONS, NT_REP_RESTRICTIONS);
rNode.setProperty("boolean", true);
- rNode.setProperty(PropertyStates.createProperty("longs", ImmutableList.of(vf.createValue(10), vf.createValue(290))));
+ rNode.setProperty(PropertyStates.createProperty("longs", List.of(vf.createValue(10), vf.createValue(290))));
rNode.setProperty(REP_GLOB, "*");
- rNode.setProperty(REP_NT_NAMES, ImmutableList.of(), Type.NAMES); // empty array
+ rNode.setProperty(REP_NT_NAMES, List.of(), Type.NAMES); // empty array
provider.validateRestrictions("/test", aceNode);
@@ -162,7 +162,7 @@ public class CompositeRestrictionProviderTest extends AbstractSecurityTest imple
rNode.setProperty("boolean", true);
}
- rNode.setProperty(REP_GLOB, ImmutableList.of("*", "/jcr:content"), Type.STRINGS);
+ rNode.setProperty(REP_GLOB, List.of("*", "/jcr:content"), Type.STRINGS);
try {
provider.validateRestrictions("/test", aceNode);
fail("validation should detect wrong restriction type (multi vs single valued)");
@@ -175,9 +175,9 @@ public class CompositeRestrictionProviderTest extends AbstractSecurityTest imple
public void testValidateRestrictionsAtEntryNode() throws Exception {
Tree aceNode = TreeUtil.addChild(root.getTree("/"), "test", NT_REP_GRANT_ACE);
aceNode.setProperty("boolean", true);
- aceNode.setProperty(PropertyStates.createProperty("longs", ImmutableList.of(vf.createValue(10), vf.createValue(290))));
+ aceNode.setProperty(PropertyStates.createProperty("longs", List.of(vf.createValue(10), vf.createValue(290))));
aceNode.setProperty(REP_GLOB, "*");
- aceNode.setProperty(REP_NT_NAMES, ImmutableList.of(), Type.NAMES); // empty array
+ aceNode.setProperty(REP_NT_NAMES, List.of(), Type.NAMES); // empty array
provider.validateRestrictions("/test", aceNode);
}
@@ -188,7 +188,7 @@ public class CompositeRestrictionProviderTest extends AbstractSecurityTest imple
Tree aceNode = TreeUtil.addChild(root.getTree("/"), "test", NT_REP_GRANT_ACE);
Tree rNode = TreeUtil.addChild(aceNode, REP_RESTRICTIONS, NT_REP_RESTRICTIONS);
- rNode.setProperty(PropertyStates.createProperty("longs", ImmutableList.of(vf.createValue(10), vf.createValue(290))));
+ rNode.setProperty(PropertyStates.createProperty("longs", List.of(vf.createValue(10), vf.createValue(290))));
try {
rp.validateRestrictions("/test", aceNode);
@@ -223,7 +223,7 @@ public class CompositeRestrictionProviderTest extends AbstractSecurityTest imple
assertFalse(provider.getPattern("/test", aceNode) instanceof CompositePattern);
rNode.setProperty("boolean", true);
- rNode.setProperty(PropertyStates.createProperty("longs", ImmutableList.of(vf.createValue(10), vf.createValue(290))));
+ rNode.setProperty(PropertyStates.createProperty("longs", List.of(vf.createValue(10), vf.createValue(290))));
assertTrue(provider.getPattern("/test", rNode) instanceof CompositePattern);
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CurrentPatternTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CurrentPatternTest.java
index 93606f012f..141885ca65 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CurrentPatternTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/CurrentPatternTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.restriction;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -148,7 +147,7 @@ public class CurrentPatternTest {
@Test
public void testMatchesPath() {
- List<String[]> propNames = ImmutableList.of(new String[0], new String[]{RESIDUAL_NAME}, new String[] {PROP_NAME});
+ List<String[]> propNames = List.of(new String[0], new String[]{RESIDUAL_NAME}, new String[] {PROP_NAME});
for (String[] pn : propNames) {
RestrictionPattern rp = createPattern(pn);
assertTrue(rp.matches(TEST_PATH));
@@ -172,7 +171,7 @@ public class CurrentPatternTest {
}
// pattern with * or all propnames will match
- List<String[]> propNames = ImmutableList.of(new String[]{RESIDUAL_NAME}, knownPropertyNames);
+ List<String[]> propNames = List.of(new String[]{RESIDUAL_NAME}, knownPropertyNames);
for (String[] names : propNames) {
rp = createPattern(names);
for (String pn : knownPropertyNames) {
@@ -205,7 +204,7 @@ public class CurrentPatternTest {
}
// pattern with * or all node-names will NOT match because they point to items that are known to be nodes
- List<String[]> propNames = ImmutableList.of(new String[]{RESIDUAL_NAME}, knownNodeNames);
+ List<String[]> propNames = List.of(new String[]{RESIDUAL_NAME}, knownNodeNames);
for (String[] names : propNames) {
rp = createPattern(names);
for (String pn : knownNodeNames) {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNamePatternTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNamePatternTest.java
index e7211674d9..cc3e4fd0e8 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNamePatternTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNamePatternTest.java
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.security.authorization.restriction;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -53,7 +52,7 @@ public class ItemNamePatternTest extends AbstractSecurityTest {
public void testMatchesItem() throws Exception {
Tree rootTree = root.getTree("/");
- List<String> matching = ImmutableList.of("a", "b", "c", "d/e/a", "a/b/c/d/b", "test/c");
+ List<String> matching = List.of("a", "b", "c", "d/e/a", "a/b/c/d/b", "test/c");
for (String relPath : matching) {
Tree testTree = addTree(rootTree, relPath);
@@ -64,7 +63,7 @@ public class ItemNamePatternTest extends AbstractSecurityTest {
testTree.remove();
}
- List<String> notMatching = ImmutableList.of("d", "b/d", "d/e/f", "c/b/abc");
+ List<String> notMatching = List.of("d", "b/d", "d/e/f", "c/b/abc");
for (String relPath : notMatching) {
Tree testTree = addTree(rootTree, relPath);
@@ -78,12 +77,12 @@ public class ItemNamePatternTest extends AbstractSecurityTest {
@Test
public void testMatchesPath() {
- List<String> matching = ImmutableList.of("/a", "/b", "/c", "/d/e/a", "/a/b/c/d/b", "/test/c");
+ List<String> matching = List.of("/a", "/b", "/c", "/d/e/a", "/a/b/c/d/b", "/test/c");
for (String p : matching) {
assertTrue(pattern.matches(p));
}
- List<String> notMatching = ImmutableList.of("/", "/d", "/b/d", "/d/e/f", "/c/b/abc");
+ List<String> notMatching = List.of("/", "/d", "/b/d", "/d/e/f", "/c/b/abc");
for (String p : notMatching) {
assertFalse(pattern.matches(p));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNameRestrictionTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNameRestrictionTest.java
index 95478f462c..5837faa672 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNameRestrictionTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ItemNameRestrictionTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.restriction;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.user.Group;
@@ -71,12 +70,12 @@ public class ItemNameRestrictionTest extends AbstractRestrictionTest {
public void testRead() {
Root testRoot = testSession.getLatestRoot();
- List<String> visible = ImmutableList.of("/a", "/a/d/b", "/a/d/b/e/c");
+ List<String> visible = List.of("/a", "/a/d/b", "/a/d/b/e/c");
for (String p : visible) {
assertTrue(testRoot.getTree(p).exists());
}
- List<String> invisible = ImmutableList.of("/", "/a/d", "/a/d/b/e", "/a/d/b/e/c/f");
+ List<String> invisible = List.of("/", "/a/d", "/a/d/b/e", "/a/d/b/e/c/f");
for (String p : invisible) {
assertFalse(testRoot.getTree(p).exists());
}
@@ -91,7 +90,7 @@ public class ItemNameRestrictionTest extends AbstractRestrictionTest {
public void testAddProperty() throws Exception {
Root testRoot = testSession.getLatestRoot();
- List<String> paths = ImmutableList.of("/a", "/a/d/b", "/a/d/b/e/c");
+ List<String> paths = List.of("/a", "/a/d/b", "/a/d/b/e/c");
for (String p : paths) {
Tree t = testRoot.getTree(p);
t.setProperty("b", "anyvalue");
@@ -132,7 +131,7 @@ public class ItemNameRestrictionTest extends AbstractRestrictionTest {
public void testAddChild() throws Exception {
Root testRoot = testSession.getLatestRoot();
- List<String> paths = ImmutableList.of("/a", "/a/d/b", "/a/d/b/e/c");
+ List<String> paths = List.of("/a", "/a/d/b", "/a/d/b/e/c");
for (String p : paths) {
Tree t = testRoot.getTree(p);
TreeUtil.addChild(t, "c", NodeTypeConstants.NT_OAK_UNSTRUCTURED);
@@ -143,7 +142,7 @@ public class ItemNameRestrictionTest extends AbstractRestrictionTest {
@Test
public void testRemoveTree() {
Root testRoot = testSession.getLatestRoot();
- List<String> paths = ImmutableList.of("/a/d/b/e/c", "/a/d/b", "/a");
+ List<String> paths = List.of("/a/d/b/e/c", "/a/d/b", "/a");
for (String p : paths) {
try {
testRoot.getTree(p).remove();
@@ -169,7 +168,7 @@ public class ItemNameRestrictionTest extends AbstractRestrictionTest {
root.commit();
Root testRoot = testSession.getLatestRoot();
- List<String> paths = ImmutableList.of("/a/d/b/e/c", "/a/d/b");
+ List<String> paths = List.of("/a/d/b/e/c", "/a/d/b");
for (String p : paths) {
testRoot.getTree(p).remove();
testRoot.commit();
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/NodeTypePatternTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/NodeTypePatternTest.java
index 5d2ef62d1d..5144efa7f0 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/NodeTypePatternTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/NodeTypePatternTest.java
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.security.authorization.restriction;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Tree;
@@ -58,7 +57,7 @@ public class NodeTypePatternTest extends AbstractSecurityTest {
public void testNotMatchesItem() throws Exception {
Tree rootTree = root.getTree("/");
- List<String> notMatching = ImmutableList.of(NodeTypeConstants.NT_OAK_RESOURCE, NodeTypeConstants.NT_OAK_UNSTRUCTURED, JcrConstants.NT_VERSION);
+ List<String> notMatching = List.of(NodeTypeConstants.NT_OAK_RESOURCE, NodeTypeConstants.NT_OAK_UNSTRUCTURED, JcrConstants.NT_VERSION);
for (String ntName : notMatching) {
Tree testTree = TreeUtil.addChild(rootTree, "name", ntName);
@@ -72,7 +71,7 @@ public class NodeTypePatternTest extends AbstractSecurityTest {
@Test
public void testMatchesPath() {
- List<String> notMatching = ImmutableList.of("/", "/a", "/b", "/c", "/d/e/a", "/a/b/c/d/b", "/test/c", "/d", "/b/d", "/d/e/f", "/c/b/abc");
+ List<String> notMatching = List.of("/", "/a", "/b", "/c", "/d/e/a", "/a/b/c/d/b", "/test/c", "/d", "/b/d", "/d/e/f", "/c/b/abc");
for (String p : notMatching) {
assertFalse(pattern.matches(p));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/PrefixPatternTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/PrefixPatternTest.java
index 06f5074dc4..a1c38d0e9a 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/PrefixPatternTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/PrefixPatternTest.java
@@ -20,7 +20,6 @@ import java.util.List;
import java.util.Set;
import javax.jcr.NamespaceRegistry;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Tree;
@@ -55,7 +54,7 @@ public class PrefixPatternTest extends AbstractSecurityTest {
testTree.remove();
}
- List<String> notMatching = ImmutableList.of(NamespaceRegistry.PREFIX_EMPTY, NamespaceRegistry.PREFIX_MIX, "any");
+ List<String> notMatching = List.of(NamespaceRegistry.PREFIX_EMPTY, NamespaceRegistry.PREFIX_MIX, "any");
for (String prefix : notMatching) {
String name = (prefix.isEmpty()) ? "name" : prefix + ":name";
Tree testTree = TreeUtil.addChild(rootTree, name, NodeTypeConstants.NT_OAK_UNSTRUCTURED);
@@ -71,7 +70,7 @@ public class PrefixPatternTest extends AbstractSecurityTest {
@Test
public void testMatchesPath() {
- List<String> notMatching = ImmutableList.of("/", "/a", "/d/jcr:e/a");
+ List<String> notMatching = List.of("/", "/a", "/d/jcr:e/a");
for (String p : notMatching) {
assertFalse(p, pattern.matches(p));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImplTest.java
index 021bc46d96..4221ac4b92 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImplTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.restriction;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
@@ -132,7 +131,7 @@ public class RestrictionProviderImplTest extends AbstractSecurityTest implements
public void testGetRestrictionPattern() throws Exception {
Map<PropertyState, RestrictionPattern> map = new HashMap<>();
map.put(PropertyStates.createProperty(REP_GLOB, "/*/jcr:content"), GlobPattern.create("/testPath", "/*/jcr:content"));
- List<String> ntNames = ImmutableList.of(JcrConstants.NT_FOLDER, JcrConstants.NT_LINKEDFILE);
+ List<String> ntNames = List.of(JcrConstants.NT_FOLDER, JcrConstants.NT_LINKEDFILE);
map.put(PropertyStates.createProperty(REP_NT_NAMES, ntNames, Type.NAMES), new NodeTypePattern(ntNames));
Tree tree = TreeUtil.getOrAddChild(root.getTree("/"), "testPath", JcrConstants.NT_UNSTRUCTURED);
@@ -161,17 +160,17 @@ public class RestrictionProviderImplTest extends AbstractSecurityTest implements
Map<PropertyState, RestrictionPattern> map = new HashMap<>();
String globRestriction = "/*/jcr:content";
map.put(PropertyStates.createProperty(REP_GLOB, globRestriction), GlobPattern.create("/testPath", globRestriction));
- List<String> ntNames = ImmutableList.of(JcrConstants.NT_FOLDER, JcrConstants.NT_LINKEDFILE);
+ List<String> ntNames = List.of(JcrConstants.NT_FOLDER, JcrConstants.NT_LINKEDFILE);
map.put(PropertyStates.createProperty(REP_NT_NAMES, ntNames, Type.NAMES), new NodeTypePattern(ntNames));
- List<String> prefixes = ImmutableList.of("rep", "jcr");
+ List<String> prefixes = List.of("rep", "jcr");
map.put(PropertyStates.createProperty(REP_PREFIXES, prefixes, Type.STRINGS), new PrefixPattern(prefixes));
- List<String> itemNames = ImmutableList.of("abc", "jcr:primaryType");
+ List<String> itemNames = List.of("abc", "jcr:primaryType");
map.put(PropertyStates.createProperty(REP_ITEM_NAMES, prefixes, Type.NAMES), new ItemNamePattern(itemNames));
- List<String> propNames = ImmutableList.of("jcr:mixinTypes", "jcr:primaryType");
+ List<String> propNames = List.of("jcr:mixinTypes", "jcr:primaryType");
map.put(PropertyStates.createProperty(REP_CURRENT, propNames, Type.STRINGS), new CurrentPattern("/testPath", propNames));
List<String> globs = Collections.singletonList(globRestriction);
map.put(PropertyStates.createProperty(REP_GLOBS, globs, Type.STRINGS), new GlobsPattern("/testPath", globs));
- List<String> subtrees = ImmutableList.of("/sub/tree", "/a/b/c/");
+ List<String> subtrees = List.of("/sub/tree", "/a/b/c/");
map.put(PropertyStates.createProperty(REP_SUBTREES, subtrees, Type.STRINGS), new SubtreePattern("/testPath", subtrees));
Tree tree = TreeUtil.getOrAddChild(root.getTree("/"), "testPath", JcrConstants.NT_UNSTRUCTURED);
@@ -191,22 +190,22 @@ public class RestrictionProviderImplTest extends AbstractSecurityTest implements
Map<PropertyState, RestrictionPattern> map = new HashMap<>();
map.put(PropertyStates.createProperty(REP_GLOB, globRestriction), GlobPattern.create("/testPath", globRestriction));
- List<String> ntNames = ImmutableList.of(JcrConstants.NT_FOLDER, JcrConstants.NT_LINKEDFILE);
+ List<String> ntNames = List.of(JcrConstants.NT_FOLDER, JcrConstants.NT_LINKEDFILE);
map.put(PropertyStates.createProperty(REP_NT_NAMES, ntNames, Type.NAMES), new NodeTypePattern(ntNames));
- List<String> prefixes = ImmutableList.of("rep", "jcr");
+ List<String> prefixes = List.of("rep", "jcr");
map.put(PropertyStates.createProperty(REP_PREFIXES, prefixes, Type.STRINGS), new PrefixPattern(prefixes));
- List<String> itemNames = ImmutableList.of("abc", "jcr:primaryType");
+ List<String> itemNames = List.of("abc", "jcr:primaryType");
map.put(PropertyStates.createProperty(REP_ITEM_NAMES, itemNames, Type.NAMES), new ItemNamePattern(itemNames));
- List<String> propNames = ImmutableList.of("*");
+ List<String> propNames = List.of("*");
map.put(PropertyStates.createProperty(REP_CURRENT, propNames, Type.STRINGS), new CurrentPattern("/testPath", propNames));
List<String> globs = Collections.singletonList(globRestriction);
map.put(PropertyStates.createProperty(REP_GLOBS, globs, Type.STRINGS), new GlobsPattern("/testPath", globs));
- List<String> subtrees = ImmutableList.of("/sub/tree", "/a/b/c/");
+ List<String> subtrees = List.of("/sub/tree", "/a/b/c/");
map.put(PropertyStates.createProperty(REP_SUBTREES, subtrees, Type.STRINGS), new SubtreePattern("/testPath", subtrees));
Tree tree = TreeUtil.getOrAddChild(root.getTree("/"), "testPath", JcrConstants.NT_UNSTRUCTURED);
@@ -259,7 +258,7 @@ public class RestrictionProviderImplTest extends AbstractSecurityTest implements
AccessControlManager acMgr = getAccessControlManager(root);
- List<String> globs = ImmutableList.of(
+ List<String> globs = List.of(
"/1*/2*/3*/4*/5*/6*/7*/8*/9*/10*/11*/12*/13*/14*/15*/16*/17*/18*/19*/20*/21*",
"*********************");
for (String glob : globs) {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
index 723c552a00..0d3b5b2282 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.internal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
@@ -887,7 +886,7 @@ public class SecurityProviderRegistrationTest extends AbstractSecurityTest {
SortedMap m = (SortedMap) f.get(registration);
assertEquals(3, m.size());
Collection c = m.values();
- assertTrue(Iterables.elementsEqual(ImmutableList.of(service2, service3, service1), c));
+ assertTrue(Iterables.elementsEqual(List.of(service2, service3, service1), c));
}
@Test
@@ -1105,7 +1104,7 @@ public class SecurityProviderRegistrationTest extends AbstractSecurityTest {
assertNull(context.getService(SecurityProvider.class));
AuthorizationConfiguration mockConfiguration = mockConfiguration(AuthorizationConfiguration.class);
- when(mockConfiguration.getMonitors(any(StatisticsProvider.class))).thenReturn(ImmutableList.of(new TestMonitor()));
+ when(mockConfiguration.getMonitors(any(StatisticsProvider.class))).thenReturn(List.of(new TestMonitor()));
registration.bindAuthorizationConfiguration(mockConfiguration, Collections.singletonMap(SERVICE_PID, "customAuthorizationConfig"));
SecurityProvider service = context.getService(SecurityProvider.class);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImplTest.java
index f983f8cacc..5115a6b24c 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImplTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.jackrabbit.oak.security.principal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import java.util.List;
+
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Root;
@@ -128,7 +129,7 @@ public class PrincipalConfigurationImplTest extends AbstractSecurityTest {
@NotNull
@Override
public Iterable<? extends SecurityConfiguration> getConfigurations() {
- return ImmutableList.of();
+ return List.of();
}
@NotNull
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHookTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHookTest.java
index 42dd60c8f5..21170954a8 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHookTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHookTest.java
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.oak.security.privilege;
+import java.util.List;
import java.util.Set;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Root;
@@ -107,7 +107,7 @@ public class JcrAllCommitHookTest extends AbstractSecurityTest {
Root r = adminSession.getLatestRoot();
Tree t = r.getTree(PRIVILEGES_PATH);
Tree jcrAll = t.getChild(JCR_ALL);
- jcrAll.setProperty(REP_AGGREGATES, ImmutableList.of("newPriv"), Type.NAMES);
+ jcrAll.setProperty(REP_AGGREGATES, List.of("newPriv"), Type.NAMES);
t.addChild("newPriv");
NodeState after = getTreeProvider().asNodeState(r.getTree(PathUtils.ROOT_PATH));
hook.processCommit(before, after, null);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContextTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContextTest.java
index 746b3f9c21..1fbeb1bcc8 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContextTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContextTest.java
@@ -17,7 +17,7 @@
package org.apache.jackrabbit.oak.security.privilege;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -123,7 +123,7 @@ public class PrivilegeContextTest {
@Test
public void testDefinesLocation() {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
PrivilegeConstants.PRIVILEGES_PATH,
PrivilegeConstants.PRIVILEGES_PATH + "/child",
PrivilegeConstants.PRIVILEGES_PATH + "/another/child"
@@ -139,7 +139,7 @@ public class PrivilegeContextTest {
@Test
public void testNotDefinesLocation() {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
PathUtils.ROOT_PATH,
PrivilegeConstants.PRIVILEGES_PATH + "sibling",
"/some/other/path",
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeImplTest.java
index 4b6f2babb2..ccc829ec03 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeImplTest.java
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.oak.security.privilege;
+import java.util.List;
import java.util.Set;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
@@ -163,7 +163,7 @@ public class PrivilegeImplTest extends AbstractSecurityTest implements Privilege
public void testInvalidDeclaredAggregate() throws Exception {
Tree privilegeDefs = root.getTree(PRIVILEGES_PATH);
Tree privDef = TreeUtil.addChild(privilegeDefs, "test", NT_REP_PRIVILEGE);
- privDef.setProperty(REP_AGGREGATES, ImmutableList.of(JCR_READ, "invalid"), Type.NAMES);
+ privDef.setProperty(REP_AGGREGATES, List.of(JCR_READ, "invalid"), Type.NAMES);
Privilege p = getPrivilegeManager(root).getPrivilege("test");
assertAggregation(p.getDeclaredAggregatePrivileges(), JCR_READ);
@@ -173,7 +173,7 @@ public class PrivilegeImplTest extends AbstractSecurityTest implements Privilege
public void testCyclicDeclaredAggregate() throws Exception {
Tree privilegeDefs = root.getTree(PRIVILEGES_PATH);
Tree privDef = TreeUtil.addChild(privilegeDefs, "test", NT_REP_PRIVILEGE);
- privDef.setProperty(REP_AGGREGATES, ImmutableList.of(JCR_READ, "test"), Type.NAMES);
+ privDef.setProperty(REP_AGGREGATES, List.of(JCR_READ, "test"), Type.NAMES);
Privilege p = getPrivilegeManager(root).getPrivilege("test");
assertAggregation(p.getDeclaredAggregatePrivileges(), JCR_READ);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorTest.java
index fcb7eadaa5..41e683c024 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorTest.java
@@ -17,9 +17,9 @@
package org.apache.jackrabbit.oak.security.privilege;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -129,7 +129,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
try {
Tree privTree = createPrivilegeTree("test");
privTree.setProperty(PropertyStates.createProperty(REP_AGGREGATES,
- ImmutableList.of(JCR_READ, JCR_MODIFY_PROPERTIES), Type.NAMES));
+ List.of(JCR_READ, JCR_MODIFY_PROPERTIES), Type.NAMES));
setPrivilegeBits(privTree, REP_BITS, 340);
root.commit();
@@ -211,7 +211,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
public void testAggregatesIncludesJcrAll() throws Exception {
try {
Tree privTree = createPrivilegeTree("test");
- privTree.setProperty(PropertyStates.createProperty(REP_AGGREGATES, ImmutableList.of(JCR_ALL, JCR_READ, JCR_WRITE), Type.NAMES));
+ privTree.setProperty(PropertyStates.createProperty(REP_AGGREGATES, List.of(JCR_ALL, JCR_READ, JCR_WRITE), Type.NAMES));
PrivilegeBits.getInstance(bitsProvider.getBits(JCR_ALL, JCR_READ, JCR_WRITE)).writeTo(privTree);
root.commit();
@@ -224,7 +224,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
public void testAggregatesMatchesExisting() throws Exception {
try {
Tree privTree = createPrivilegeTree("test");
- privTree.setProperty(PropertyStates.createProperty(REP_AGGREGATES, ImmutableList.of(REP_READ_NODES, REP_READ_PROPERTIES), Type.NAMES));
+ privTree.setProperty(PropertyStates.createProperty(REP_AGGREGATES, List.of(REP_READ_NODES, REP_READ_PROPERTIES), Type.NAMES));
PrivilegeBits.getInstance(bitsProvider.getBits(REP_READ_NODES, REP_READ_PROPERTIES)).writeTo(privTree);
root.commit();
@@ -236,8 +236,8 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
@Test(expected = CommitFailedException.class)
public void testPropertyChanged() throws Exception {
try {
- PropertyState before = PropertyStates.createProperty(REP_AGGREGATES, ImmutableList.of(REP_READ_NODES, REP_READ_PROPERTIES), Type.NAMES);
- PropertyState after = PropertyStates.createProperty(REP_AGGREGATES, ImmutableList.of(REP_READ_NODES), Type.NAMES);
+ PropertyState before = PropertyStates.createProperty(REP_AGGREGATES, List.of(REP_READ_NODES, REP_READ_PROPERTIES), Type.NAMES);
+ PropertyState after = PropertyStates.createProperty(REP_AGGREGATES, List.of(REP_READ_NODES), Type.NAMES);
PrivilegeValidator validator = new PrivilegeValidator(root, root, getTreeProvider());
validator.propertyChanged(before, after);
@@ -249,7 +249,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
@Test(expected = CommitFailedException.class)
public void testPropertyDeleted() throws Exception {
try {
- PropertyState before = PropertyStates.createProperty(REP_AGGREGATES, ImmutableList.of(REP_READ_NODES, REP_READ_PROPERTIES), Type.NAMES);
+ PropertyState before = PropertyStates.createProperty(REP_AGGREGATES, List.of(REP_READ_NODES, REP_READ_PROPERTIES), Type.NAMES);
PrivilegeValidator validator = new PrivilegeValidator(root, root, getTreeProvider());
validator.propertyDeleted(before);
@@ -288,7 +288,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
NodeState newDef = new MemoryNodeBuilder(EmptyNodeState.EMPTY_NODE)
.setProperty(JCR_PRIMARYTYPE, NT_REP_PRIVILEGE)
.setProperty(REP_BITS, 8)
- .setProperty(REP_AGGREGATES, ImmutableList.of("unknown", JCR_READ), Type.NAMES)
+ .setProperty(REP_AGGREGATES, List.of("unknown", JCR_READ), Type.NAMES)
.getNodeState();
PrivilegeValidator validator = createPrivilegeValidator();
@@ -306,7 +306,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
NodeState newDef = new MemoryNodeBuilder(EmptyNodeState.EMPTY_NODE)
.setProperty(JCR_PRIMARYTYPE, NT_REP_PRIVILEGE)
.setProperty(REP_BITS, 8)
- .setProperty(REP_AGGREGATES, ImmutableList.of("test", JCR_READ), Type.NAMES)
+ .setProperty(REP_AGGREGATES, List.of("test", JCR_READ), Type.NAMES)
.getNodeState();
PrivilegeValidator validator = createPrivilegeValidator();
@@ -325,7 +325,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
NodeState newDef = new MemoryNodeBuilder(EmptyNodeState.EMPTY_NODE)
.setProperty(JCR_PRIMARYTYPE, NT_REP_PRIVILEGE)
.setProperty(REP_BITS, 8)
- .setProperty(REP_AGGREGATES, ImmutableList.of("test2", JCR_READ), Type.NAMES)
+ .setProperty(REP_AGGREGATES, List.of("test2", JCR_READ), Type.NAMES)
.getNodeState();
PrivilegeValidator validator = createPrivilegeValidator();
@@ -344,7 +344,7 @@ public class PrivilegeValidatorTest extends AbstractSecurityTest implements Priv
Tree privDefs = root.getTree(PRIVILEGES_PATH);
Tree newPriv = TreeUtil.addChild(privDefs, "newPriv", NT_REP_PRIVILEGE);
PrivilegeBits.getInstance(PrivilegeBits.BUILT_IN.get(JCR_READ), PrivilegeBits.BUILT_IN.get(JCR_ADD_CHILD_NODES)).writeTo(newPriv);
- newPriv.setProperty(REP_AGGREGATES, ImmutableList.of(JCR_READ, JCR_ADD_CHILD_NODES), Type.NAMES);
+ newPriv.setProperty(REP_AGGREGATES, List.of(JCR_READ, JCR_ADD_CHILD_NODES), Type.NAMES);
TreeProvider tp = mock(TreeProvider.class);
when(tp.createReadOnlyTree(any(Tree.class), anyString(), any(NodeState.class))).thenReturn(newPriv);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AbstractGroupPrincipalTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AbstractGroupPrincipalTest.java
index fa6b8123f3..b07ed1eee0 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AbstractGroupPrincipalTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AbstractGroupPrincipalTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -87,7 +86,7 @@ public class AbstractGroupPrincipalTest extends AbstractSecurityTest {
@Test
public void testIsMemberMissingAuthorizable() {
- List<Principal> principals = ImmutableList.of(
+ List<Principal> principals = List.of(
new PrincipalImpl("name"),
() -> "name"
);
@@ -108,7 +107,7 @@ public class AbstractGroupPrincipalTest extends AbstractSecurityTest {
@Test
public void testIsMemberOfEveryoneMissingAuthorizable() {
- List<Principal> principals = ImmutableList.of(
+ List<Principal> principals = List.of(
new PrincipalImpl("name"),
() -> "name"
);
@@ -188,7 +187,7 @@ public class AbstractGroupPrincipalTest extends AbstractSecurityTest {
@NotNull
@Override
Iterator<Authorizable> getMembers() throws RepositoryException {
- return ImmutableList.of(member).iterator();
+ return List.of(member).iterator();
}
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AddMembersByIdBestEffortTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AddMembersByIdBestEffortTest.java
index c4c16a8513..df8b6b14bc 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AddMembersByIdBestEffortTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AddMembersByIdBestEffortTest.java
@@ -17,11 +17,11 @@
package org.apache.jackrabbit.oak.security.user;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Authorizable;
@@ -110,7 +110,7 @@ public class AddMembersByIdBestEffortTest extends AbstractAddMembersByIdTest {
assertTrue(failed.isEmpty());
Iterable<String> memberIds = getMemberIds(testGroup);
- Iterables.elementsEqual(ImmutableList.copyOf(NON_EXISTING_IDS), memberIds);
+ Iterables.elementsEqual(Arrays.asList(NON_EXISTING_IDS), memberIds);
Iterator<Authorizable> members = testGroup.getDeclaredMembers();
assertFalse(members.hasNext());
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AuthorizableIteratorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AuthorizableIteratorTest.java
index 0484a939a4..ac965482b1 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AuthorizableIteratorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/AuthorizableIteratorTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.User;
@@ -100,7 +99,7 @@ public class AuthorizableIteratorTest extends AbstractSecurityTest {
@Test
public void testFilterDuplicates() throws Exception {
- List<Authorizable> l = ImmutableList.of(getTestUser());
+ List<Authorizable> l = List.of(getTestUser());
assertEquals(1, Iterators.size(AuthorizableIterator.create(true, l.iterator(), l.iterator())));
assertEquals(2, Iterators.size(AuthorizableIterator.create(false, l.iterator(), l.iterator())));
@@ -119,7 +118,7 @@ public class AuthorizableIteratorTest extends AbstractSecurityTest {
public void testFilterDuplicatesGetIdFails() throws Exception {
Authorizable a = when(mock(Authorizable.class).getID()).thenThrow(new RepositoryException()).getMock();
- List<Authorizable> l = ImmutableList.of(getTestUser(), a);
+ List<Authorizable> l = List.of(getTestUser(), a);
assertEquals(1, Iterators.size(AuthorizableIterator.create(true, l.iterator(), Collections.emptyIterator())));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/GroupImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/GroupImplTest.java
index daa120d8fe..e88bc84bc4 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/GroupImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/GroupImplTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -31,6 +30,7 @@ import org.junit.Test;
import javax.jcr.nodetype.ConstraintViolationException;
import java.security.Principal;
import java.util.Iterator;
+import java.util.List;
import java.util.UUID;
import static org.apache.jackrabbit.oak.spi.security.user.UserConstants.REP_MEMBERS;
@@ -165,7 +165,7 @@ public class GroupImplTest extends AbstractUserTest {
@Test
public void testImpactOfOak8054AddingMembers() throws Exception {
Tree groupTree = root.getTree(group.getPath());
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(new UserProvider(root, ConfigurationParameters.EMPTY).getContentID(getTestUser().getID())), Type.STRINGS);
+ groupTree.setProperty(REP_MEMBERS, List.of(new UserProvider(root, ConfigurationParameters.EMPTY).getContentID(getTestUser().getID())), Type.STRINGS);
root.commit();
group.addMember(uMgr.createUser("userid", null));
@@ -182,7 +182,7 @@ public class GroupImplTest extends AbstractUserTest {
User user = uMgr.createUser("userid", null);
UserProvider up = new UserProvider(root, ConfigurationParameters.EMPTY);
Tree groupTree = root.getTree(group.getPath());
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(up.getContentID(getTestUser().getID()), up.getContentID(user.getID())), Type.STRINGS);
+ groupTree.setProperty(REP_MEMBERS, List.of(up.getContentID(getTestUser().getID()), up.getContentID(user.getID())), Type.STRINGS);
root.commit();
group.removeMembers(user.getID());
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/ImpersonationImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/ImpersonationImplTest.java
index 1b244b09d4..bd05b2cd97 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/ImpersonationImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/ImpersonationImplTest.java
@@ -18,13 +18,13 @@ package org.apache.jackrabbit.oak.security.user;
import java.security.Principal;
import java.util.Enumeration;
+import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.jcr.RepositoryException;
import javax.security.auth.Subject;
import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
import org.apache.jackrabbit.api.security.user.Group;
@@ -93,7 +93,7 @@ public class ImpersonationImplTest extends ImpersonationImplEmptyTest {
PropertyState property = tree.getProperty(UserConstants.REP_IMPERSONATORS);
assertNotNull(property);
- assertEquals(ImmutableList.of(impersonator.getPrincipal().getName()), property.getValue(Type.STRINGS));
+ assertEquals(List.of(impersonator.getPrincipal().getName()), property.getValue(Type.STRINGS));
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/IntermediatePathTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/IntermediatePathTest.java
index e6685bc4b2..69fb4b94fa 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/IntermediatePathTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/IntermediatePathTest.java
@@ -22,7 +22,6 @@ import java.util.UUID;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -139,7 +138,7 @@ public class IntermediatePathTest extends AbstractSecurityTest {
@Test
public void testInvalidAbsolutePaths() throws Exception {
TreeUtil.addChild(root.getTree(PathUtils.ROOT_PATH), "testNode", NodeTypeConstants.NT_OAK_UNSTRUCTURED);
- List<String> invalidPaths = ImmutableList.of(
+ List<String> invalidPaths = List.of(
"/",
PathUtils.getAncestorPath(UserConstants.DEFAULT_GROUP_PATH, 1),
PathUtils.getAncestorPath(UserConstants.DEFAULT_GROUP_PATH, 2),
@@ -183,7 +182,7 @@ public class IntermediatePathTest extends AbstractSecurityTest {
@Test
public void testRelativePaths() throws Exception {
TreeUtil.addChild(root.getTree(PathUtils.ROOT_PATH), "testNode", NodeTypeConstants.NT_OAK_UNSTRUCTURED);
- List<String> invalidPaths = ImmutableList.of("..", "../..", "../../..", "../../../testNode","a/b/../../../c");
+ List<String> invalidPaths = List.of("..", "../..", "../../..", "../../../testNode","a/b/../../../c");
for (String relPath : invalidPaths) {
try {
createAuthorizable(false, relPath);
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordExpiryHistoryTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordExpiryHistoryTest.java
index f7698b6835..2001c24914 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordExpiryHistoryTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordExpiryHistoryTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
@@ -36,6 +35,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
+import java.util.List;
import java.util.Map;
/**
@@ -57,7 +57,7 @@ public class PasswordExpiryHistoryTest extends AbstractSecurityTest {
pwAction.init(null, ConfigurationParameters.of(
PasswordValidationAction.CONSTRAINT, "^.*(?=.{4,}).*"
));
- final AuthorizableActionProvider actionProvider = securityProvider -> ImmutableList.of(pwAction);
+ final AuthorizableActionProvider actionProvider = securityProvider -> List.of(pwAction);
ConfigurationParameters userConfig = ConfigurationParameters.of(
Map.of(
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordHistoryTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordHistoryTest.java
index d2c31065a1..08139e751b 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordHistoryTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/PasswordHistoryTest.java
@@ -24,11 +24,11 @@ import java.util.Map;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
@@ -62,7 +62,9 @@ public class PasswordHistoryTest extends AbstractSecurityTest implements UserCon
@NotNull
private List<String> getHistory(@NotNull User user) throws RepositoryException {
Iterable<String> history = TreeUtil.getStrings(root.getTree(user.getPath()).getChild(REP_PWD), REP_PWD_HISTORY);
- return (history == null) ? Collections.emptyList() : ImmutableList.copyOf(history).reverse();
+ List<String> result = history == null ? Collections.emptyList() : CollectionUtils.toList(history);
+ Collections.reverse(result);
+ return result;
}
/**
@@ -217,7 +219,7 @@ public class PasswordHistoryTest extends AbstractSecurityTest implements UserCon
User user = getTestUser();
Tree userTree = root.getTree(user.getPath());
- List<ConfigurationParameters> configs = ImmutableList.of(
+ List<ConfigurationParameters> configs = List.of(
ConfigurationParameters.EMPTY,
ConfigurationParameters.of(PARAM_PASSWORD_HISTORY_SIZE, PASSWORD_HISTORY_DISABLED_SIZE),
ConfigurationParameters.of(PARAM_PASSWORD_HISTORY_SIZE, -1),
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/SystemUserImplTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/SystemUserImplTest.java
index dc7aea0c5f..b268e6bc35 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/SystemUserImplTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/SystemUserImplTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.api.security.user.UserManager;
@@ -49,6 +48,7 @@ import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.security.auth.login.LoginException;
import java.util.Iterator;
+import java.util.List;
import java.util.UUID;
import static org.junit.Assert.assertEquals;
@@ -95,7 +95,7 @@ public class SystemUserImplTest extends AbstractSecurityTest {
ConfigurationParameters.of(UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, (AuthorizableActionProvider) securityProvider -> {
AuthorizableAction action = new AccessControlAction();
action.init(securityProvider, ConfigurationParameters.of(AccessControlAction.USER_PRIVILEGE_NAMES, new String[]{PrivilegeConstants.JCR_ALL}));
- return ImmutableList.of(action);
+ return List.of(action);
}));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserContextTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserContextTest.java
index 1b9aa5da03..4afdd01266 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserContextTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserContextTest.java
@@ -21,7 +21,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -225,7 +224,7 @@ public class UserContextTest implements UserConstants {
NT_REP_GROUP, GROUP_PROPERTY_NAMES,
NT_REP_USER, USER_PROPERTY_NAMES,
NT_REP_PASSWORD, PWD_PROPERTY_NAMES,
- NT_REP_MEMBER_REFERENCES, ImmutableList.of(REP_MEMBERS)
+ NT_REP_MEMBER_REFERENCES, List.of(REP_MEMBERS)
);
m.forEach((key, value) -> {
@@ -302,7 +301,7 @@ public class UserContextTest implements UserConstants {
@Test
public void testNotDefinesLocation() {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
PathUtils.ROOT_PATH,
NodeTypeConstants.NODE_TYPES_PATH,
"/content",
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterBaseTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterBaseTest.java
index 15a22c7c20..b91b5a75b9 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterBaseTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterBaseTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.user.User;
@@ -65,7 +64,7 @@ public abstract class UserImporterBaseTest extends AbstractSecurityTest implemen
@NotNull
@Override
public List<? extends AuthorizableAction> getAuthorizableActions(@NotNull SecurityProvider securityProvider) {
- return (testAction == null) ? ImmutableList.of() : ImmutableList.of(testAction);
+ return (testAction == null) ? List.of() : List.of(testAction);
}
};
@@ -206,6 +205,6 @@ public abstract class UserImporterBaseTest extends AbstractSecurityTest implemen
@NotNull
NodeInfo createNodeInfo(@NotNull String name, @NotNull String primaryTypeName) {
- return new NodeInfo(name, primaryTypeName, ImmutableList.of(), null);
+ return new NodeInfo(name, primaryTypeName, List.of(), null);
}
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterImpersonationIgnoreTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterImpersonationIgnoreTest.java
index 9a0ac48143..0265afca07 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterImpersonationIgnoreTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterImpersonationIgnoreTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -34,6 +33,7 @@ import org.junit.Test;
import javax.jcr.RepositoryException;
import java.security.Principal;
+import java.util.List;
import java.util.Set;
import static org.junit.Assert.assertEquals;
@@ -73,7 +73,7 @@ public class UserImporterImpersonationIgnoreTest extends UserImporterBaseTest {
PropertyState impersonators = userTree.getProperty(REP_IMPERSONATORS);
assertNotNull(impersonators);
- assertEquals(ImmutableList.of(testUser.getPrincipal().getName()), impersonators.getValue(Type.STRINGS));
+ assertEquals(List.of(testUser.getPrincipal().getName()), impersonators.getValue(Type.STRINGS));
}
@Test
@@ -83,7 +83,7 @@ public class UserImporterImpersonationIgnoreTest extends UserImporterBaseTest {
PropertyState impersonators = userTree.getProperty(REP_IMPERSONATORS);
assertNotNull(impersonators);
- assertEquals(ImmutableList.of(testUser.getPrincipal().getName()), impersonators.getValue(Type.STRINGS));
+ assertEquals(List.of(testUser.getPrincipal().getName()), impersonators.getValue(Type.STRINGS));
}
@Test(expected = RepositoryException.class)
@@ -102,19 +102,19 @@ public class UserImporterImpersonationIgnoreTest extends UserImporterBaseTest {
@Test
public void testReplaceExistingProperty() throws Exception {
- userTree.setProperty(REP_IMPERSONATORS, ImmutableList.of("impersonator1"), Type.STRINGS);
+ userTree.setProperty(REP_IMPERSONATORS, List.of("impersonator1"), Type.STRINGS);
assertTrue(importer.handlePropInfo(userTree, createPropInfo(REP_IMPERSONATORS, testUser.getPrincipal().getName()), mockPropertyDefinition(NT_REP_USER, true)));
importer.processReferences();
PropertyState impersonators = userTree.getProperty(REP_IMPERSONATORS);
assertNotNull(impersonators);
- assertEquals(ImmutableList.of(testUser.getPrincipal().getName()), impersonators.getValue(Type.STRINGS));
+ assertEquals(List.of(testUser.getPrincipal().getName()), impersonators.getValue(Type.STRINGS));
}
@Test
public void testReplaceExistingProperty2() throws Exception {
- userTree.setProperty(REP_IMPERSONATORS, ImmutableList.of("impersonator1"), Type.STRINGS);
+ userTree.setProperty(REP_IMPERSONATORS, List.of("impersonator1"), Type.STRINGS);
assertTrue(importer.handlePropInfo(userTree, createPropInfo(REP_IMPERSONATORS, "impersonator1", testUser.getPrincipal().getName()), mockPropertyDefinition(NT_REP_USER, true)));
importer.processReferences();
@@ -138,7 +138,7 @@ public class UserImporterImpersonationIgnoreTest extends UserImporterBaseTest {
PropertyState impersonators = userTree.getProperty(REP_IMPERSONATORS);
assertNotNull(impersonators);
- assertEquals(ImmutableList.of("impersonator1"), impersonators.getValue(Type.STRINGS));
+ assertEquals(List.of("impersonator1"), impersonators.getValue(Type.STRINGS));
}
@Test
@@ -156,7 +156,7 @@ public class UserImporterImpersonationIgnoreTest extends UserImporterBaseTest {
PropertyState impersonators = userTree.getProperty(REP_IMPERSONATORS);
assertNotNull(impersonators);
- assertEquals(ImmutableList.of("impersonator1"), impersonators.getValue(Type.STRINGS));
+ assertEquals(List.of("impersonator1"), impersonators.getValue(Type.STRINGS));
}
@Test
@@ -176,7 +176,7 @@ public class UserImporterImpersonationIgnoreTest extends UserImporterBaseTest {
return null;
}).when(ua).onRevokeImpersonation(any(User.class), any(Principal.class), any(Root.class), any(NamePathMapper.class));
- userTree.setProperty(REP_IMPERSONATORS, ImmutableList.of("impersonator1"), Type.STRINGS);
+ userTree.setProperty(REP_IMPERSONATORS, List.of("impersonator1"), Type.STRINGS);
assertTrue(importer.handlePropInfo(userTree, createPropInfo(REP_IMPERSONATORS), mockPropertyDefinition(NT_REP_USER, true)));
importer.processReferences();
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipAbortTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipAbortTest.java
index 8d8d22faec..c4e44304fb 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipAbortTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipAbortTest.java
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.security.user;
import javax.jcr.nodetype.ConstraintViolationException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
@@ -26,6 +25,8 @@ import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
+import java.util.List;
+
import static org.junit.Assert.assertTrue;
public class UserImporterMembershipAbortTest extends UserImporterMembershipIgnoreTest {
@@ -38,13 +39,13 @@ public class UserImporterMembershipAbortTest extends UserImporterMembershipIgnor
@Test(expected = ConstraintViolationException.class)
public void testUnknownMember() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, unknownContentId)));
importer.processReferences();
}
@Test(expected = ConstraintViolationException.class)
public void testMixedMembers() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
importer.processReferences();
}
@@ -59,7 +60,7 @@ public class UserImporterMembershipAbortTest extends UserImporterMembershipIgnor
@Test(expected = ConstraintViolationException.class)
public void testNewMembersToEveryone() throws Exception {
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(knownMemberContentId), Type.STRINGS);
+ groupTree.setProperty(REP_MEMBERS, List.of(knownMemberContentId), Type.STRINGS);
groupTree.setProperty(REP_PRINCIPAL_NAME, EveryonePrincipal.NAME);
Tree userTree = createUserTree();
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipBesteffortTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipBesteffortTest.java
index 324f1f0fa8..5d7ec9d279 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipBesteffortTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipBesteffortTest.java
@@ -16,11 +16,12 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
+import java.util.List;
+
import static org.junit.Assert.assertTrue;
public class UserImporterMembershipBesteffortTest extends UserImporterMembershipIgnoreTest {
@@ -33,7 +34,7 @@ public class UserImporterMembershipBesteffortTest extends UserImporterMembership
@Test
public void testUnknownMember() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, unknownContentId)));
importer.processReferences();
assertTrue(groupTree.hasProperty(REP_MEMBERS));
@@ -41,7 +42,7 @@ public class UserImporterMembershipBesteffortTest extends UserImporterMembership
@Test
public void testMixedMembers() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
importer.processReferences();
assertTrue(groupTree.hasProperty(REP_MEMBERS));
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipIgnoreTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipIgnoreTest.java
index 87c0e70ddf..ff94c3df30 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipIgnoreTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterMembershipIgnoreTest.java
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Set;
import javax.jcr.RepositoryException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -68,13 +67,13 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidMemberContentId() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, "memberId")));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, "memberId")));
importer.processReferences();
}
@Test
public void testUnknownMember() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, unknownContentId)));
importer.processReferences();
// default importbehavior == IGNORE
@@ -83,7 +82,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
@Test
public void testKnownMemberThresholdNotReached() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
importer.processReferences();
assertTrue(groupTree.hasProperty(REP_MEMBERS));
@@ -97,7 +96,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
}
groupTree.setProperty(REP_MEMBERS, memberIds, Type.STRINGS);
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
importer.processReferences();
assertEquals(1, memberRefList.getChildrenCount(100));
@@ -106,7 +105,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
@Test
public void testMixedMembers() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, unknownContentId, knownMemberContentId)));
importer.processReferences();
assertFalse(memberRefList.hasChild("memberRef"));
@@ -114,7 +113,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
@Test(expected = RepositoryException.class)
public void testGroupRemovedBeforeProcessing() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
groupTree.remove();
importer.processReferences();
@@ -122,14 +121,14 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
@Test(expected = RepositoryException.class)
public void testUserConvertedGroupBeforeProcessing() throws Exception {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
groupTree.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_USER);
importer.processReferences();
}
@Test
public void testAddMemberToNonExistingMember() throws Exception {
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(unknownContentId), Type.STRINGS);
+ groupTree.setProperty(REP_MEMBERS, List.of(unknownContentId), Type.STRINGS);
assertTrue(importer.handlePropInfo(groupTree, createPropInfo(REP_MEMBERS, knownMemberContentId), mockPropertyDefinition(NT_REP_GROUP, true)));
importer.processReferences();
@@ -145,7 +144,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
String contentId = userProvider.getContentID(userTree);
assertTrue(importer.handlePropInfo(userTree, createPropInfo(REP_AUTHORIZABLE_ID, TEST_USER_ID), mockPropertyDefinition(NT_REP_AUTHORIZABLE, false)));
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(knownMemberContentId), Type.STRINGS);
+ groupTree.setProperty(REP_MEMBERS, List.of(knownMemberContentId), Type.STRINGS);
assertTrue(importer.handlePropInfo(groupTree, createPropInfo(REP_MEMBERS, contentId), mockPropertyDefinition(NT_REP_GROUP, true)));
importer.processReferences();
@@ -165,7 +164,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
PropertyState members = groupTree.getProperty(REP_MEMBERS);
assertNotNull(members);
- assertEquals(ImmutableList.of(contentId), ImmutableList.copyOf(members.getValue(Type.STRINGS)));
+ assertEquals(List.of(contentId), CollectionUtils.toList(members.getValue(Type.STRINGS)));
}
@Test
@@ -180,7 +179,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
PropertyState members = groupTree.getProperty(REP_MEMBERS);
assertNotNull(members);
- assertEquals(ImmutableList.of(contentId), ImmutableList.copyOf(members.getValue(Type.STRINGS)));
+ assertEquals(List.of(contentId), CollectionUtils.toList((members.getValue(Type.STRINGS))));
}
@Test
@@ -197,7 +196,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
@Test
public void testNewMembersToEveryone() throws Exception {
- groupTree.setProperty(REP_MEMBERS, ImmutableList.of(knownMemberContentId), Type.STRINGS);
+ groupTree.setProperty(REP_MEMBERS, List.of(knownMemberContentId), Type.STRINGS);
groupTree.setProperty(REP_PRINCIPAL_NAME, EveryonePrincipal.NAME);
Tree userTree = createUserTree();
@@ -209,7 +208,7 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
PropertyState members = groupTree.getProperty(REP_MEMBERS);
assertNotNull(members);
- assertEquals(ImmutableList.of(knownMemberContentId), ImmutableList.copyOf(members.getValue(Type.STRINGS)));
+ assertEquals(List.of(knownMemberContentId), CollectionUtils.toList((members.getValue(Type.STRINGS))));
}
@Test
@@ -227,6 +226,6 @@ public class UserImporterMembershipIgnoreTest extends UserImporterBaseTest {
PropertyState members = groupTree.getProperty(REP_MEMBERS);
assertNotNull(members);
- assertEquals(ImmutableList.of(contentId), ImmutableList.copyOf(members.getValue(Type.STRINGS)));
+ assertEquals(List.of(contentId), CollectionUtils.toList((members.getValue(Type.STRINGS))));
}
}
\ No newline at end of file
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterTest.java
index abe4b03f79..a8782755da 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserImporterTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
@@ -52,6 +51,7 @@ import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.PropertyDefinition;
import java.lang.reflect.Field;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import static org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants.NT_OAK_UNSTRUCTURED;
@@ -625,7 +625,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
@Test(expected = IllegalStateException.class)
public void testStartChildInfoIllegalState() {
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, "member1")));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, "member1")));
}
@Test(expected = IllegalStateException.class)
@@ -635,7 +635,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
memberRefList.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_MEMBER_REFERENCES_LIST);
importer.start(memberRefList);
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, "member1")));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, "member1")));
}
@Test
@@ -646,7 +646,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
memberRefList.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_MEMBER_REFERENCES_LIST);
assertTrue(importer.start(memberRefList));
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of());
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of());
}
@Test
@@ -657,7 +657,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
memberRefList.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_MEMBER_REFERENCES_LIST);
assertTrue(importer.start(memberRefList));
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, "member1")));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo(REP_MEMBERS, "member1")));
}
@Test
@@ -668,7 +668,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
memberRefList.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_MEMBER_REFERENCES_LIST);
importer.start(memberRefList);
- importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo("otherName", "member1")));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), List.of(createPropInfo("otherName", "member1")));
importer.processReferences();
// no members should have been added to the group node
@@ -684,7 +684,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
Tree repMembers = groupTree.addChild("memberTree");
repMembers.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_MEMBERS);
assertTrue(importer.start(repMembers));
- importer.startChildInfo(createNodeInfo("memberTree", NT_REP_MEMBERS), ImmutableList.of(createPropInfo("anyProp", "memberValue")));
+ importer.startChildInfo(createNodeInfo("memberTree", NT_REP_MEMBERS), List.of(createPropInfo("anyProp", "memberValue")));
}
@Test
@@ -695,7 +695,7 @@ public class UserImporterTest extends UserImporterBaseTest implements UserConsta
memberRefList.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_MEMBER_REFERENCES_LIST);
assertTrue(importer.start(memberRefList));
- importer.startChildInfo(createNodeInfo("memberRef", NT_OAK_UNSTRUCTURED), ImmutableList.of(createPropInfo(REP_MEMBERS, "member1")));
+ importer.startChildInfo(createNodeInfo("memberRef", NT_OAK_UNSTRUCTURED), List.of(createPropInfo(REP_MEMBERS, "member1")));
}
//-------------------------------------------------------< endChildInfo >---
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/GroupActionTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/GroupActionTest.java
index d4c8cd6fd4..302926740e 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/GroupActionTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/GroupActionTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user.action;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.User;
@@ -33,6 +32,7 @@ import org.junit.Before;
import org.junit.Test;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
import static org.mockito.Mockito.mock;
@@ -45,7 +45,7 @@ public class GroupActionTest extends AbstractSecurityTest {
private static final String TEST_USER_PREFIX = "testUser";
final GroupAction groupAction = mock(GroupAction.class);
- private final AuthorizableActionProvider actionProvider = securityProvider -> ImmutableList.of(groupAction);
+ private final AuthorizableActionProvider actionProvider = securityProvider -> List.of(groupAction);
private User testUser01;
private User testUser02;
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/PasswordValidationActionTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/PasswordValidationActionTest.java
index 0b910ad496..abba077269 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/PasswordValidationActionTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/PasswordValidationActionTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.jackrabbit.oak.security.user.action;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import java.util.List;
+
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Type;
@@ -44,7 +45,7 @@ public class PasswordValidationActionTest extends AbstractSecurityTest {
private final PasswordValidationAction pwAction = new PasswordValidationAction();
private final AuthorizableAction testAction = mock(AuthorizableAction.class);
- private final AuthorizableActionProvider actionProvider = securityProvider -> ImmutableList.of(pwAction, testAction);
+ private final AuthorizableActionProvider actionProvider = securityProvider -> List.of(pwAction, testAction);
@Before
public void before() throws Exception {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/UserActionTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/UserActionTest.java
index bbff8dda1e..db0b8e6133 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/UserActionTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/action/UserActionTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user.action;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.Root;
@@ -35,6 +34,7 @@ import org.junit.Test;
import javax.jcr.RepositoryException;
import javax.jcr.ValueFactory;
import java.security.Principal;
+import java.util.List;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -50,7 +50,7 @@ public class UserActionTest extends AbstractSecurityTest {
private UserAction userAction = mock(UserAction.class);
private ClearProfileAction clearProfileAction = new ClearProfileAction();
- private final AuthorizableActionProvider actionProvider = securityProvider -> ImmutableList.of(userAction, clearProfileAction);
+ private final AuthorizableActionProvider actionProvider = securityProvider -> List.of(userAction, clearProfileAction);
@Override
protected ConfigurationParameters getSecurityConfigParameters() {
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/QueryUtilTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/QueryUtilTest.java
index f95c8d0189..00b7ed2b0f 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/QueryUtilTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/QueryUtilTest.java
@@ -24,7 +24,6 @@ import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.QueryBuilder;
@@ -159,7 +158,7 @@ public class QueryUtilTest {
@Test
public void testEscapeNodeName() {
- List<String> names = ImmutableList.of("name", JcrConstants.JCR_CREATED, "%name", "a%name", "name%");
+ List<String> names = List.of("name", JcrConstants.JCR_CREATED, "%name", "a%name", "name%");
for (String name : names) {
assertEquals(QueryUtils.escapeNodeName(name), QueryUtil.escapeNodeName(name));
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/ResultIteratorTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/ResultIteratorTest.java
index 6f6c3b4dfd..0b4b916dec 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/ResultIteratorTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/ResultIteratorTest.java
@@ -18,9 +18,9 @@ package org.apache.jackrabbit.oak.security.user.query;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.NoSuchElementException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.junit.Test;
@@ -37,7 +37,7 @@ public class ResultIteratorTest {
@Test
public void testCreateWithoutLimitation() {
- Iterator<String> it = ImmutableList.of("str").iterator();
+ Iterator<String> it = List.of("str").iterator();
assertSame(it, ResultIterator.create(ResultIterator.OFFSET_NONE, ResultIterator.MAX_ALL, it));
}
@@ -58,22 +58,22 @@ public class ResultIteratorTest {
@Test
public void testCreateOffsetLtSize() {
- assertEquals(1, Iterators.size(ResultIterator.create(1, ResultIterator.MAX_ALL, ImmutableList.of("str", "str").iterator())));
+ assertEquals(1, Iterators.size(ResultIterator.create(1, ResultIterator.MAX_ALL, List.of("str", "str").iterator())));
}
@Test
public void testCreateOffsetEqualsMax() {
- assertEquals(1, Iterators.size(ResultIterator.create(1, 1, ImmutableList.of("str", "str").iterator())));
+ assertEquals(1, Iterators.size(ResultIterator.create(1, 1, List.of("str", "str").iterator())));
}
@Test
public void testCreateOffsetGtMax() {
- assertEquals(1, Iterators.size(ResultIterator.create(2, 1, ImmutableList.of("str", "str", "str").iterator())));
+ assertEquals(1, Iterators.size(ResultIterator.create(2, 1, List.of("str", "str", "str").iterator())));
}
@Test
public void testCreateOffsetLtMax() {
- Iterator resultIt = ResultIterator.create(1, 3, ImmutableList.of("str", "str", "str", "str").iterator());
+ Iterator resultIt = ResultIterator.create(1, 3, List.of("str", "str", "str", "str").iterator());
assertEquals(3, Iterators.size(resultIt));
}
@@ -85,7 +85,7 @@ public class ResultIteratorTest {
@Test
public void testNextWithOffset() {
- Iterator<String> it = ResultIterator.create(1, ResultIterator.MAX_ALL, ImmutableList.of("str", "str2").iterator());
+ Iterator<String> it = ResultIterator.create(1, ResultIterator.MAX_ALL, List.of("str", "str2").iterator());
assertEquals("str2", it.next());
}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManagerTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManagerTest.java
index a3c476adae..0a372ee494 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManagerTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManagerTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.user.query;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -496,7 +495,7 @@ public class UserQueryManagerTest extends AbstractUserTest {
};
Iterator<Authorizable> result = queryMgr.findAuthorizables(q);
- assertEquals(ImmutableList.of(user, g2, g), ImmutableList.copyOf(result));
+ assertEquals(List.of(user, g2, g), CollectionUtils.toList(result));
}
@Test
@@ -517,7 +516,7 @@ public class UserQueryManagerTest extends AbstractUserTest {
};
Iterator<Authorizable> result = queryMgr.findAuthorizables(q);
- assertEquals(ImmutableList.of(user, g, g2), ImmutableList.copyOf(result));
+ assertEquals(List.of(user, g, g2), CollectionUtils.toList(result));
}
@Test
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/whiteboard/WhiteboardAuthorizableActionProviderTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/whiteboard/WhiteboardAuthorizableActionProviderTest.java
index e46fb2bd27..e7be81e0e5 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/whiteboard/WhiteboardAuthorizableActionProviderTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/whiteboard/WhiteboardAuthorizableActionProviderTest.java
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.security.user.whiteboard;
import java.util.List;
import java.util.Map;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
import org.apache.jackrabbit.oak.spi.security.user.action.AbstractAuthorizableAction;
import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction;
@@ -64,7 +63,7 @@ public class WhiteboardAuthorizableActionProviderTest {
public void testRegisteredImplementation() {
actionProvider.start(whiteboard);
- AuthorizableActionProvider registered = securityProvider -> ImmutableList.of(new TestAction());
+ AuthorizableActionProvider registered = securityProvider -> List.of(new TestAction());
whiteboard.register(AuthorizableActionProvider.class, registered, Map.of());
List<? extends AuthorizableAction> actions = actionProvider.getAuthorizableActions(Mockito.mock(SecurityProvider.class));
diff --git a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L4_EffectivePoliciesTest.java b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L4_EffectivePoliciesTest.java
index d443f0d924..9583db37a3 100644
--- a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L4_EffectivePoliciesTest.java
+++ b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L4_EffectivePoliciesTest.java
@@ -27,7 +27,6 @@ import javax.jcr.security.AccessControlManager;
import javax.jcr.security.AccessControlPolicy;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
@@ -270,7 +269,7 @@ public class L4_EffectivePoliciesTest extends AbstractJCRTest {
testSession = getTestSession();
AccessControlManager testAcMgr = testSession.getAccessControlManager();
- List<String> paths = ImmutableList.of(testRoot, NodeTypeConstants.NODE_TYPES_PATH);
+ List<String> paths = List.of(testRoot, NodeTypeConstants.NODE_TYPES_PATH);
for (String path : paths) {
// EXERCISE : complete or fix the test case
AccessControlPolicy[] effectivePolicies = testAcMgr.getEffectivePolicies(path);
diff --git a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L5_AccessControlListImplTest.java b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L5_AccessControlListImplTest.java
index d4d274e983..46fc6ed626 100644
--- a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L5_AccessControlListImplTest.java
+++ b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L5_AccessControlListImplTest.java
@@ -17,6 +17,7 @@
package org.apache.jackrabbit.oak.exercise.security.authorization.accesscontrol;
import java.security.Principal;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.jcr.RepositoryException;
@@ -27,7 +28,6 @@ import javax.jcr.security.AccessControlException;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.JackrabbitWorkspace;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
@@ -186,15 +186,16 @@ public class L5_AccessControlListImplTest extends AbstractJCRTest {
public void testAddEntryWithInvalidPrincipals() throws Exception {
// EXERCISE: explain for each principal in the list why using it for an ACE fails
- List<Principal> invalidPrincipals = ImmutableList.of(
+ List<Principal> invalidPrincipals = Arrays.asList(
new InvalidTestPrincipal("unknown"),
null,
- new PrincipalImpl(""), new Principal() {
- @Override
- public String getName() {
- return "unknown";
- }
- });
+ new PrincipalImpl(""),
+ new Principal() {
+ @Override
+ public String getName() {
+ return "unknown";
+ }
+ });
for (Principal principal : invalidPrincipals) {
try {
@@ -227,7 +228,7 @@ public class L5_AccessControlListImplTest extends AbstractJCRTest {
Privilege customPriv = ((JackrabbitWorkspace) superuser.getWorkspace()).getPrivilegeManager().registerPrivilege(privilegeName, true, new String[0]);
// EXERCISE : walks through this test and explain why adding those ACEs fails.
- List<Privilege[]> invalidPrivileges = ImmutableList.of(
+ List<Privilege[]> invalidPrivileges = Arrays.asList(
new Privilege[0],
null,
new Privilege[] {customPriv}
diff --git a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/advanced/L5_CustomPermissionEvaluationTest.java b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/advanced/L5_CustomPermissionEvaluationTest.java
index 656aef48e0..06424a920b 100644
--- a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/advanced/L5_CustomPermissionEvaluationTest.java
+++ b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/advanced/L5_CustomPermissionEvaluationTest.java
@@ -25,7 +25,6 @@ import javax.jcr.GuestCredentials;
import javax.jcr.Session;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
@@ -204,8 +203,7 @@ public class L5_CustomPermissionEvaluationTest extends AbstractSecurityTest {
root.commit();
- trees = ImmutableList.<Tree>builder().add(root.getTree("/")).add(testTree).add(aTree).add(aaTree).add(bTree).add(bbTree).add(cTree).add(ccTree).build();
-
+ trees = List.of(root.getTree("/"), testTree, aTree, aaTree, bTree, bbTree, cTree, ccTree);
}
private PermissionProvider getPermissionProvider(@NotNull Set<Principal> principals) {
@@ -270,7 +268,7 @@ public class L5_CustomPermissionEvaluationTest extends AbstractSecurityTest {
@Test
public void testWriteAccess() throws Exception {
- List<Set<Principal>> editors = ImmutableList.<Set<Principal>>of(
+ List<Set<Principal>> editors = List.<Set<Principal>>of(
Set.of(new Editor("ida")),
Set.of(EveryonePrincipal.getInstance(), new Editor("amanda")),
Set.of(getTestUser().getPrincipal(),new Editor("susi")),
@@ -310,7 +308,7 @@ public class L5_CustomPermissionEvaluationTest extends AbstractSecurityTest {
@Test
public void testReadAccess() throws Exception {
- List<Set<Principal>> readers = ImmutableList.<Set<Principal>>of(
+ List<Set<Principal>> readers = List.of(
Set.of(new Reader("ida")),
Set.of(EveryonePrincipal.getInstance(), new Reader("fairuz")),
Set.of(getTestUser().getPrincipal(),new Editor("juni")),
diff --git a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/privilege/L3_BuiltInPrivilegesTest.java b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/privilege/L3_BuiltInPrivilegesTest.java
index ffedf62fa5..33fc37bda0 100644
--- a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/privilege/L3_BuiltInPrivilegesTest.java
+++ b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/privilege/L3_BuiltInPrivilegesTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.exercise.security.privilege;
+import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import javax.jcr.RepositoryException;
@@ -23,7 +24,6 @@ import javax.jcr.security.AccessControlManager;
import javax.jcr.security.AccessControlPolicy;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
@@ -133,7 +133,7 @@ public class L3_BuiltInPrivilegesTest extends AbstractSecurityTest {
);
Iterable<Privilege> aggregated = Iterables.<Privilege>filter(
- ImmutableList.<Privilege>copyOf(privilegeManager.getRegisteredPrivileges()),
+ Arrays.asList(privilegeManager.getRegisteredPrivileges()),
input -> input != null && input.isAggregate());
for (Privilege aggrPrivilege : aggregated) {
diff --git a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L6_AuthorizableContentTest.java b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L6_AuthorizableContentTest.java
index 5366a5315d..7724b2f1ec 100644
--- a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L6_AuthorizableContentTest.java
+++ b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L6_AuthorizableContentTest.java
@@ -20,7 +20,6 @@ import java.util.List;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -149,7 +148,7 @@ public class L6_AuthorizableContentTest extends AbstractJCRTest {
String expectedNodeTypeName = null; // EXERCISE
assertEquals(expectedNodeTypeName, node.getPrimaryNodeType().getName());
- List<String> mixinTypes = ImmutableList.of(); // EXERCISE : fill the list
+ List<String> mixinTypes = List.of(); // EXERCISE : fill the list
for (String mixin : mixinTypes) {
assertTrue(node.isNodeType(mixin));
}
@@ -174,7 +173,7 @@ public class L6_AuthorizableContentTest extends AbstractJCRTest {
String expectedNodeTypeName = null; // EXERCISE
assertEquals(expectedNodeTypeName, node.getPrimaryNodeType().getName());
- List<String> mixinTypes = ImmutableList.of(); // EXERCISE : fill the list
+ List<String> mixinTypes = List.of(); // EXERCISE : fill the list
for (String mixin : mixinTypes) {
assertTrue(node.isNodeType(mixin));
}
diff --git a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L7_AuthorizablePropertiesTest.java b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L7_AuthorizablePropertiesTest.java
index 1b8ea63c0f..c1e9f2d213 100644
--- a/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L7_AuthorizablePropertiesTest.java
+++ b/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/user/L7_AuthorizablePropertiesTest.java
@@ -22,7 +22,6 @@ import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.user.Authorizable;
@@ -125,7 +124,7 @@ public class L7_AuthorizablePropertiesTest extends AbstractJCRTest {
Node node = getAuthorizableNode(testUser);
// EXERCISE: build the list of existing user properties rel paths
- List<String> userPropertiesPath = ImmutableList.of();
+ List<String> userPropertiesPath = List.of();
for (String relPath : userPropertiesPath) {
assertTrue(testUser.hasProperty(relPath));
}
@@ -139,13 +138,13 @@ public class L7_AuthorizablePropertiesTest extends AbstractJCRTest {
assertArrayEquals(petsExpected, node.getProperty(expectedRelPath).getValues());
// EXERCISE: build a list of protected JCR properties that cannot be accessed using the Authorizable interface
- List<String> protectedJcrPropertyNames = ImmutableList.of();
+ List<String> protectedJcrPropertyNames = List.of();
for (String relPath : protectedJcrPropertyNames) {
assertFalse(testUser.hasProperty(relPath));
}
// EXERCISE: build a list of protected properties defined by the authorizable or user node type definitions that cannot be accessed using the Authorizable interface
- List<String> protectedAuthorizablePropertyNames = ImmutableList.of();
+ List<String> protectedAuthorizablePropertyNames = List.of();
for (String relPath : protectedAuthorizablePropertyNames) {
assertFalse(testUser.hasProperty(relPath));
}
diff --git a/oak-it/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java b/oak-it/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java
index c4e44bd858..e4a63f1f9f 100644
--- a/oak-it/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java
+++ b/oak-it/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java
@@ -28,8 +28,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.OakBaseTest;
import org.apache.jackrabbit.oak.fixture.NodeStoreFixture;
@@ -60,7 +58,7 @@ public class TreeTest extends OakBaseTest {
public void setUp() {
repository = new Oak(store)
.with(new OpenSecurityProvider())
- .with(new CompositeConflictHandler(ImmutableList.of(
+ .with(new CompositeConflictHandler(List.of(
ConflictHandlers.wrap(new ChildOrderConflictHandler() {
/**
* Allow deleting changed node.
diff --git a/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateClusterTestIT.java b/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateClusterTestIT.java
index 285dca7192..69908e95b1 100644
--- a/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateClusterTestIT.java
+++ b/oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateClusterTestIT.java
@@ -53,7 +53,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.io.Closer;
public class AsyncIndexUpdateClusterTestIT {
@@ -65,8 +64,7 @@ public class AsyncIndexUpdateClusterTestIT {
private MemoryBlobStore bs;
private Random random = new Random();
- private final List<String> values = ImmutableList.of("a", "b", "c", "d",
- "e");
+ private final List<String> values = List.of("a", "b", "c", "d", "e");
private Closer closer = Closer.create();
private final AtomicBoolean illegalReindex = new AtomicBoolean(false);
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/IndexCostEvaluationTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/IndexCostEvaluationTest.java
index c0f43e5b50..f09e2eb21b 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/IndexCostEvaluationTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/IndexCostEvaluationTest.java
@@ -17,7 +17,6 @@
package org.apache.jackrabbit.oak;
import ch.qos.logback.classic.Level;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitRepository;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
@@ -113,7 +112,7 @@ public class IndexCostEvaluationTest {
@Override
public @NotNull List<? extends QueryIndex> getQueryIndexes(NodeState nodeState) {
- return ImmutableList.<QueryIndex>of(index);
+ return List.of(index);
}
}
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java
index 6224f87d43..38f6fd39d3 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java
@@ -32,8 +32,6 @@ import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
import org.junit.After;
@@ -62,7 +60,7 @@ public class NamePathTest {
@Test
public void testSlashInPath() throws RepositoryException {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"//jcr:content",
"//content"
);
@@ -71,7 +69,7 @@ public class NamePathTest {
@Test
public void testSlashInName() throws RepositoryException {
- List<String> names = ImmutableList.of(
+ List<String> names = List.of(
"/jcr:content",
"/content",
"jcr:con/ent",
@@ -83,7 +81,7 @@ public class NamePathTest {
@Test
public void testColonInPath() throws RepositoryException {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"/jcr:con:ent"
);
testPaths(paths);
@@ -91,7 +89,7 @@ public class NamePathTest {
@Test
public void testColonInName() throws RepositoryException {
- List<String> names = ImmutableList.of(
+ List<String> names = List.of(
"jcr:con:ent"
);
testNames(names);
@@ -99,7 +97,7 @@ public class NamePathTest {
@Test
public void testSquareBracketsInPath() throws RepositoryException {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"//jcr:content",
"/jcr:con]ent",
"/con]ent"
@@ -109,7 +107,7 @@ public class NamePathTest {
@Test
public void testSquareBracketsInName() throws RepositoryException {
- List<String> names = ImmutableList.of(
+ List<String> names = List.of(
"jcr:content[1]",
"content[1]",
"jcr:conten[t]",
@@ -135,7 +133,7 @@ public class NamePathTest {
@Test
public void testAsteriskInPath() throws RepositoryException {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"/jcr:con*ent",
"/jcr:*ontent",
"/jcr:conten*",
@@ -148,7 +146,7 @@ public class NamePathTest {
@Test
public void testAsteriskInName() throws RepositoryException {
- List<String> names = ImmutableList.of(
+ List<String> names = List.of(
"jcr:con*ent",
"jcr:*ontent",
"jcr:conten*",
@@ -161,7 +159,7 @@ public class NamePathTest {
@Test
public void testVerticalLineInPath() throws Exception {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"/jcr:con|ent",
"/jcr:|ontent",
"/jcr:conten|",
@@ -174,7 +172,7 @@ public class NamePathTest {
@Test
public void testVerticalLineInName() throws Exception {
- List<String> names = ImmutableList.of(
+ List<String> names = List.of(
"jcr:con|ent",
"jcr:|ontent",
"jcr:conten|",
@@ -187,7 +185,7 @@ public class NamePathTest {
@Test
public void testWhitespaceInPath() throws Exception {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"/content ",
"/ content",
"/content\t",
@@ -201,7 +199,7 @@ public class NamePathTest {
@Test
public void testWhitespaceInName() throws Exception {
- List<String> names = ImmutableList.of(
+ List<String> names = List.of(
"jcr:content ",
"content ",
" content",
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/HasPermissionTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/HasPermissionTest.java
index a8dad6686b..8fa0aff676 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/HasPermissionTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/HasPermissionTest.java
@@ -22,7 +22,6 @@ import java.util.Map;
import javax.jcr.Session;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.spi.security.authorization.permission.Permissions;
@@ -32,7 +31,7 @@ import org.apache.jackrabbit.oak.spi.security.authorization.permission.Permissio
public class HasPermissionTest extends AbstractEvaluationTest {
public void testEmpty() throws Exception {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"/", path, childPPath, path + "/rep:policy",
"/nonExisting", path + "/nonExisting");
@@ -82,7 +81,7 @@ public class HasPermissionTest extends AbstractEvaluationTest {
}
public void testMultiple() throws Exception {
- List<String> paths = ImmutableList.of(
+ List<String> paths = List.of(
"/", path, childPPath, path + "/rep:policy",
"/nonExisting", path + "/nonExisting");
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
index 2cd275ae80..22586f1ad0 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/RemappingTest.java
@@ -24,7 +24,6 @@ import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Query;
import org.apache.jackrabbit.api.security.user.QueryBuilder;
@@ -43,8 +42,8 @@ public class RemappingTest extends AbstractUserTest {
private Session session;
private Authorizable authorizable;
- private List<String> unmappedPaths = ImmutableList.of("uTest:property", "uTest:node/uTest:property2");
- private List<String> mappedPaths = ImmutableList.of("my:property", "my:node/my:property2");
+ private List<String> unmappedPaths = List.of("uTest:property", "uTest:node/uTest:property2");
+ private List<String> mappedPaths = List.of("my:property", "my:node/my:property2");
private Value nameValue;
@Override
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserQueryTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserQueryTest.java
index f2c697cfd1..7cf06c8f02 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserQueryTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserQueryTest.java
@@ -27,9 +27,7 @@ import java.util.Set;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.Query;
@@ -755,7 +753,7 @@ public class UserQueryTest extends AbstractUserTest {
}
});
- Iterator<String> continents = ImmutableList.of("africa", "america", "australia").iterator();
+ Iterator<String> continents = List.of("africa", "america", "australia").iterator();
String expected = continents.next();
while (result.hasNext()) {
Authorizable a = result.next();
@@ -779,7 +777,7 @@ public class UserQueryTest extends AbstractUserTest {
}
});
- Iterator<String> continents = ImmutableList.of("Africa", "America", "africa", "australia").iterator();
+ Iterator<String> continents = List.of("Africa", "America", "africa", "australia").iterator();
String expected = continents.next();
while (result.hasNext()) {
Authorizable a = result.next();
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/AtomicCounterIT.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/AtomicCounterIT.java
index ec590a5e8a..bfe6c5ed8f 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/AtomicCounterIT.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/AtomicCounterIT.java
@@ -18,6 +18,7 @@
*/
package org.apache.jackrabbit.oak.jcr;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -47,7 +48,6 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
import static org.apache.jackrabbit.oak.api.Type.LONG;
@@ -74,7 +74,7 @@ public class AtomicCounterIT {
NodeBuilder builder = ns.getRoot().builder();
NodeBuilder index = builder.child(INDEX_DEFINITIONS_NAME);
NodeBuilder lucene = newLuceneIndexDefinition(index, "lucene", Set.of("String"), null, "async");
- lucene.setProperty("async", of("async", "nrt"), STRINGS);
+ lucene.setProperty("async", List.of("async", "nrt"), STRINGS);
IndexDefinition.updateDefinition(index.child("lucene"));
ns.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
@@ -111,7 +111,7 @@ public class AtomicCounterIT {
Root root = session.getLatestRoot();
Tree t = root.getTree("/");
Tree counter = t.addChild("counter");
- counter.setProperty(JCR_MIXINTYPES, of(MIX_ATOMIC_COUNTER), NAMES);
+ counter.setProperty(JCR_MIXINTYPES, List.of(MIX_ATOMIC_COUNTER), NAMES);
root.commit();
root = session.getLatestRoot();
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexNodeManagerTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexNodeManagerTest.java
index 5e6d3ae44b..937b78af2e 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexNodeManagerTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexNodeManagerTest.java
@@ -16,14 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
+import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.plugins.index.lucene.directory.OakDirectory;
import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndex;
import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory;
@@ -140,7 +139,7 @@ public class IndexNodeManagerTest {
@Test
public void indexOpenedBeforeFistCycle() throws Exception {
NodeState nrtIndex = createNRTIndex();
- NodeState asyncIndex = nrtIndex.builder().setProperty("async", ImmutableList.of("async"), STRINGS).getNodeState();
+ NodeState asyncIndex = nrtIndex.builder().setProperty("async", List.of("async"), STRINGS).getNodeState();
NodeState nonAsyncIndex;
{
NodeBuilder builder = nrtIndex.builder();
@@ -193,7 +192,7 @@ public class IndexNodeManagerTest {
directory.close();
nrtIndex = indexBuilder.getNodeState();
}
- NodeState asyncIndex = nrtIndex.builder().setProperty("async", ImmutableList.of("async"), STRINGS).getNodeState();
+ NodeState asyncIndex = nrtIndex.builder().setProperty("async", List.of("async"), STRINGS).getNodeState();
NodeState nonAsyncIndex;
{
NodeBuilder builder = nrtIndex.builder();
@@ -218,7 +217,7 @@ public class IndexNodeManagerTest {
@Test
public void hasIndexingRun() {
NodeState nrtIndex = createNRTIndex();
- NodeState asyncIndex = nrtIndex.builder().setProperty("async", ImmutableList.of("async"), STRINGS).getNodeState();
+ NodeState asyncIndex = nrtIndex.builder().setProperty("async", List.of("async"), STRINGS).getNodeState();
NodeState nonAsyncIndex;
{
NodeBuilder builder = nrtIndex.builder();
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlannerTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlannerTest.java
index bea73fc3c5..45efad6168 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlannerTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlannerTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene;
import static java.util.Objects.requireNonNull;
@@ -103,8 +102,6 @@ import org.jetbrains.annotations.NotNull;
import org.junit.After;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
public class IndexPlannerTest {
private NodeState root = INITIAL_CONTENT;
@@ -121,7 +118,7 @@ public class IndexPlannerTest {
defn.setProperty(createProperty(ORDERED_PROP_NAMES, Set.of("foo"), STRINGS));
LuceneIndexNode node = createIndexNode(new LuceneIndexDefinition(root, defn.getNodeState(), "/foo"));
FulltextIndexPlanner planner = new FulltextIndexPlanner(node, "/foo", createFilter("nt:base"),
- ImmutableList.of(new OrderEntry("foo", Type.LONG, OrderEntry.Order.ASCENDING)));
+ List.of(new OrderEntry("foo", Type.LONG, OrderEntry.Order.ASCENDING)));
assertNotNull(planner.getPlan());
assertTrue(pr(planner.getPlan()).isUniquePathsRequired());
}
@@ -131,7 +128,7 @@ public class IndexPlannerTest {
NodeBuilder defn = newLucenePropertyIndexDefinition(builder, "test", Set.of("foo"), "async");
LuceneIndexNode node = createIndexNode(new LuceneIndexDefinition(root, defn.getNodeState(), "/foo"));
FulltextIndexPlanner planner = new FulltextIndexPlanner(node, "/foo", createFilter("nt:file"),
- ImmutableList.of(new OrderEntry("jcr:score", Type.LONG, OrderEntry.Order.ASCENDING)));
+ List.of(new OrderEntry("jcr:score", Type.LONG, OrderEntry.Order.ASCENDING)));
assertNull(planner.getPlan());
}
@@ -1127,7 +1124,7 @@ public class IndexPlannerTest {
filter.restrictProperty("foo", Operator.EQUAL, PropertyValues.newString("bar"));
FulltextIndexPlanner planner = new FulltextIndexPlanner(node, "/foo", filter,
- ImmutableList.of(new OrderEntry("bar", Type.LONG, OrderEntry.Order.ASCENDING)));
+ List.of(new OrderEntry("bar", Type.LONG, OrderEntry.Order.ASCENDING)));
QueryIndex.IndexPlan plan = planner.getPlan();
assertNotNull(plan);
@@ -1151,7 +1148,7 @@ public class IndexPlannerTest {
filter.setFullTextConstraint(FullTextParser.parse("bar", "mountain"));
FulltextIndexPlanner planner = new FulltextIndexPlanner(node, "/foo", filter,
- ImmutableList.of(new OrderEntry("bar", Type.LONG, OrderEntry.Order.ASCENDING)));
+ List.of(new OrderEntry("bar", Type.LONG, OrderEntry.Order.ASCENDING)));
QueryIndex.IndexPlan plan = planner.getPlan();
assertNotNull(plan);
@@ -1297,7 +1294,7 @@ public class IndexPlannerTest {
LuceneIndexDefinition definition = new LuceneIndexDefinition(root, defn.getNodeState(), "/test");
LuceneIndexNode node = createIndexNode(definition);
FulltextIndexPlanner planner = new FulltextIndexPlanner(node, "/test", createFilter("nt:base"),
- ImmutableList.of(new OrderEntry("foo", Type.LONG, OrderEntry.Order.ASCENDING),
+ List.of(new OrderEntry("foo", Type.LONG, OrderEntry.Order.ASCENDING),
new OrderEntry("bar", Type.LONG, OrderEntry.Order.ASCENDING)));
assertNotNull(planner.getPlan());
@@ -1312,7 +1309,7 @@ public class IndexPlannerTest {
LuceneIndexDefinition definition = new LuceneIndexDefinition(root, defn.getNodeState(), "/test");
LuceneIndexNode node = createIndexNode(definition);
FulltextIndexPlanner planner = new FulltextIndexPlanner(node, "/test", createFilter("nt:base"),
- ImmutableList.of(new OrderEntry("foo", Type.LONG, OrderEntry.Order.ASCENDING),
+ List.of(new OrderEntry("foo", Type.LONG, OrderEntry.Order.ASCENDING),
new OrderEntry("bar", Type.LONG, OrderEntry.Order.ASCENDING)));
assertNotNull(planner.getPlan());
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexlaneRepositoryTraversalTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexlaneRepositoryTraversalTest.java
index 14c1e55fc2..870c3ef503 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexlaneRepositoryTraversalTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexlaneRepositoryTraversalTest.java
@@ -19,7 +19,6 @@
package org.apache.jackrabbit.oak.plugins.index.lucene;
import ch.qos.logback.classic.Level;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.InitialContent;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -131,8 +130,8 @@ public class IndexlaneRepositoryTraversalTest {
Tree test1 = root.getTree("/").addChild(INDEX_DEFINITIONS_NAME).addChild("mynodetype");
test1.setProperty("jcr:primaryType", "oak:QueryIndexDefinition", Type.NAME);
test1.setProperty("type", "property");
- test1.setProperty("propertyNames", ImmutableList.of("jcr:primaryType", "jcr:mixinTypes"), Type.NAMES);
- test1.setProperty("declaringNodeTypes", ImmutableList.of("oak:QueryIndexDefinition"), Type.NAMES);
+ test1.setProperty("propertyNames", List.of("jcr:primaryType", "jcr:mixinTypes"), Type.NAMES);
+ test1.setProperty("declaringNodeTypes", List.of("oak:QueryIndexDefinition"), Type.NAMES);
test1.setProperty("nodeTypeListDefined", true);
test1.setProperty("reindex", true);
root.commit();
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinitionTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinitionTest.java
index 0d9766b388..a4abb51327 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinitionTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexDefinitionTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene;
import java.util.Collections;
@@ -25,7 +24,6 @@ import java.util.Set;
import javax.jcr.PropertyType;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
@@ -312,7 +310,7 @@ public class LuceneIndexDefinitionTest {
@Test
public void indexRuleInheritanceOrdering() throws Exception{
NodeBuilder rules = builder.child(INDEX_RULES);
- rules.setProperty(OAK_CHILD_ORDER, ImmutableList.of("nt:hierarchyNode", "nt:base"),NAMES);
+ rules.setProperty(OAK_CHILD_ORDER, List.of("nt:hierarchyNode", "nt:base"),NAMES);
rules.child("nt:hierarchyNode").setProperty(FulltextIndexConstants.FIELD_BOOST, 2.0);
rules.child("nt:base").setProperty(FulltextIndexConstants.FIELD_BOOST, 3.0);
@@ -325,7 +323,7 @@ public class LuceneIndexDefinitionTest {
@Test
public void indexRuleInheritanceOrdering2() throws Exception{
NodeBuilder rules = builder.child(INDEX_RULES);
- rules.setProperty(OAK_CHILD_ORDER, ImmutableList.of("nt:base", "nt:hierarchyNode"),NAMES);
+ rules.setProperty(OAK_CHILD_ORDER, List.of("nt:base", "nt:hierarchyNode"),NAMES);
rules.child("nt:hierarchyNode").setProperty(FulltextIndexConstants.FIELD_BOOST, 2.0);
rules.child("nt:base").setProperty(FulltextIndexConstants.FIELD_BOOST, 3.0);
@@ -400,7 +398,7 @@ public class LuceneIndexDefinitionTest {
.setProperty(FulltextIndexConstants.PROP_IS_REGEX, true)
.setProperty(FulltextIndexConstants.FIELD_BOOST, 4.0);
- rules.child("nt:folder").child(PROP_NODE).setProperty(OAK_CHILD_ORDER, ImmutableList.of("prop2", "prop1"), NAMES);
+ rules.child("nt:folder").child(PROP_NODE).setProperty(OAK_CHILD_ORDER, List.of("prop2", "prop1"), NAMES);
LuceneIndexDefinition defn = new LuceneIndexDefinition(root, builder.getNodeState(), "/foo");
@@ -416,7 +414,7 @@ public class LuceneIndexDefinitionTest {
assertEquals(4.0f, rule1.getConfig("fooProp").boost, 0);
//Order it correctly to get expected result
- rules.child("nt:folder").child(PROP_NODE).setProperty(OAK_CHILD_ORDER, ImmutableList.of("prop1", "prop2"), NAMES);
+ rules.child("nt:folder").child(PROP_NODE).setProperty(OAK_CHILD_ORDER, List.of("prop1", "prop2"), NAMES);
defn = new LuceneIndexDefinition(root, builder.getNodeState(), "/foo");
rule1 = defn.getApplicableIndexingRule(asState(newNode("nt:folder")));
assertEquals(3.0f, rule1.getConfig("fooProp").boost, 0);
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorTest.java
index a54da2e962..92ef77eff9 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene;
import java.io.File;
@@ -29,7 +28,6 @@ import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.commons.CIHelper;
import org.apache.jackrabbit.oak.plugins.blob.datastore.CachingFileDataStore;
@@ -118,7 +116,7 @@ public class LuceneIndexEditorTest {
@Parameterized.Parameters(name = "{index}: useBlobStore ({0})")
public static List<Boolean[]> fixtures() {
- return ImmutableList.of(new Boolean[] {true}, new Boolean[] {false});
+ return List.of(new Boolean[] {true}, new Boolean[] {false});
}
@Before
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
index 69c093c81c..1b998419cb 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index.lucene;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static org.apache.jackrabbit.guava.common.collect.Iterators.transform;
import static org.apache.jackrabbit.guava.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static java.util.Arrays.asList;
@@ -69,6 +68,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
import org.apache.jackrabbit.oak.plugins.index.IndexUpdate;
@@ -116,8 +116,6 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
@SuppressWarnings("ConstantConditions")
public class LuceneIndexTest {
@@ -218,7 +216,7 @@ public class LuceneIndexTest {
List<IndexPlan> plans = queryIndex.getPlans(filter, null, indexed);
Cursor cursor = queryIndex.query(plans.get(0), indexed);
- List<String> paths = copyOf(transform(cursor, IndexRow::getPath));
+ List<String> paths = CollectionUtils.toList(transform(cursor, IndexRow::getPath));
assertFalse(paths.isEmpty());
assertEquals(LuceneIndex.LUCENE_QUERY_BATCH_SIZE + 1, paths.size());
}
@@ -400,7 +398,7 @@ public class LuceneIndexTest {
FilterImpl filter = createFilter(NT_TEST);
filter.restrictProperty("foo", Operator.EQUAL, null);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/c"));
+ assertFilter(filter, queryIndex, indexed, List.of("/c"));
}
@Test
@@ -431,7 +429,7 @@ public class LuceneIndexTest {
FilterImpl filter = createFilter(NT_TEST);
filter.restrictProperty("foo", Operator.NOT_EQUAL, null);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/a","/b"));
+ assertFilter(filter, queryIndex, indexed, List.of("/a","/b"));
}
@@ -467,7 +465,7 @@ public class LuceneIndexTest {
FilterImpl filter = createFilter(NT_TEST);
filter.restrictProperty("jcr:content/bar", Operator.EQUAL, null);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/b1"));
+ assertFilter(filter, queryIndex, indexed, List.of("/b1"));
builder.child("b1").child("jcr:content").setProperty("bar", "foo");
after = builder.getNodeState();
@@ -502,19 +500,19 @@ public class LuceneIndexTest {
FilterImpl filter = createTestFilter();
filter.restrictPath("/", Filter.PathRestriction.EXACT);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/"));
+ assertFilter(filter, queryIndex, indexed, List.of("/"));
filter = createTestFilter();
filter.restrictPath("/", Filter.PathRestriction.DIRECT_CHILDREN);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/a", "/a1"));
+ assertFilter(filter, queryIndex, indexed, List.of("/a", "/a1"));
filter = createTestFilter();
filter.restrictPath("/a", Filter.PathRestriction.DIRECT_CHILDREN);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/a/b"));
+ assertFilter(filter, queryIndex, indexed, List.of("/a/b"));
filter = createTestFilter();
filter.restrictPath("/a", Filter.PathRestriction.ALL_CHILDREN);
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/a/b", "/a/b/c"));
+ assertFilter(filter, queryIndex, indexed, List.of("/a/b", "/a/b/c"));
}
@Test
@@ -538,15 +536,15 @@ public class LuceneIndexTest {
FilterImpl filter = createFilter(NT_FILE);
filter.restrictProperty(QueryConstants.RESTRICTION_LOCAL_NAME, Operator.EQUAL, PropertyValues.newString("foo"));
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/foo"));
+ assertFilter(filter, queryIndex, indexed, List.of("/foo"));
filter = createFilter(NT_FILE);
filter.restrictProperty(QueryConstants.RESTRICTION_LOCAL_NAME, Operator.LIKE, PropertyValues.newString("camelCase"));
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/camelCase"));
+ assertFilter(filter, queryIndex, indexed, List.of("/camelCase"));
filter = createFilter(NT_FILE);
filter.restrictProperty(QueryConstants.RESTRICTION_LOCAL_NAME, Operator.LIKE, PropertyValues.newString("camel%"));
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/camelCase"));
+ assertFilter(filter, queryIndex, indexed, List.of("/camelCase"));
}
private FilterImpl createTestFilter(){
@@ -573,7 +571,7 @@ public class LuceneIndexTest {
FilterImpl filter = createFilter("nt:base");
filter.setFullTextConstraint(new FullTextTerm(null, "fox jumping", false, false, null));
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/"));
+ assertFilter(filter, queryIndex, indexed, List.of("/"));
//No stop word configured so default analyzer would also check for 'was'
filter.setFullTextConstraint(new FullTextTerm(null, "fox was jumping", false, false, null));
@@ -594,36 +592,36 @@ public class LuceneIndexTest {
queryIndex = new LucenePropertyIndex(tracker);
filter.setFullTextConstraint(new FullTextTerm(null, "fox jumping", false, false, null));
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/"));
+ assertFilter(filter, queryIndex, indexed, List.of("/"));
//Now this should get passed as the analyzer would ignore 'was'
filter.setFullTextConstraint(new FullTextTerm(null, "fox was jumping", false, false, null));
- assertFilter(filter, queryIndex, indexed, ImmutableList.of("/"));
+ assertFilter(filter, queryIndex, indexed, List.of("/"));
}
@Test
public void testTokens() {
Analyzer analyzer = LuceneIndexConstants.ANALYZER;
- assertEquals(ImmutableList.of("parent", "child"),
+ assertEquals(List.of("parent", "child"),
LuceneIndex.tokenize("/parent/child", analyzer));
- assertEquals(ImmutableList.of("p1234", "p5678"),
+ assertEquals(List.of("p1234", "p5678"),
LuceneIndex.tokenize("/p1234/p5678", analyzer));
- assertEquals(ImmutableList.of("first", "second"),
+ assertEquals(List.of("first", "second"),
LuceneIndex.tokenize("first_second", analyzer));
- assertEquals(ImmutableList.of("first1", "second2"),
+ assertEquals(List.of("first1", "second2"),
LuceneIndex.tokenize("first1_second2", analyzer));
- assertEquals(ImmutableList.of("first", "second"),
+ assertEquals(List.of("first", "second"),
LuceneIndex.tokenize("first. second", analyzer));
- assertEquals(ImmutableList.of("first", "second"),
+ assertEquals(List.of("first", "second"),
LuceneIndex.tokenize("first.second", analyzer));
- assertEquals(ImmutableList.of("hello", "world"),
+ assertEquals(List.of("hello", "world"),
LuceneIndex.tokenize("hello-world", analyzer));
- assertEquals(ImmutableList.of("hello", "wor*"),
+ assertEquals(List.of("hello", "wor*"),
LuceneIndex.tokenize("hello-wor*", analyzer));
- assertEquals(ImmutableList.of("*llo", "world"),
+ assertEquals(List.of("*llo", "world"),
LuceneIndex.tokenize("*llo-world", analyzer));
- assertEquals(ImmutableList.of("*llo", "wor*"),
+ assertEquals(List.of("*llo", "wor*"),
LuceneIndex.tokenize("*llo-wor*", analyzer));
}
@@ -843,7 +841,7 @@ public class LuceneIndexTest {
newLucenePropertyIndexDefinition(index, "luceneTest", Set.of("foo"), null);
newLucenePropertyIndexDefinition(index, "luceneTest2", Set.of("foo2"), null);
- builder.child(INDEX_DEFINITIONS_NAME).child("luceneTest").setProperty(IndexConstants.ENTRY_COUNT_PROPERTY_NAME, ImmutableList.of(2L), Type.LONGS);
+ builder.child(INDEX_DEFINITIONS_NAME).child("luceneTest").setProperty(IndexConstants.ENTRY_COUNT_PROPERTY_NAME, List.of(2L), Type.LONGS);
NodeState before = builder.getNodeState();
// Add some content that qualifies to be indexed by both of the above indexes (separately)
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/MultiplexingLucenePropertyIndexTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/MultiplexingLucenePropertyIndexTest.java
index 2864cff8ee..d4a70dd1ef 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/MultiplexingLucenePropertyIndexTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/MultiplexingLucenePropertyIndexTest.java
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.oak.api.QueryEngine.NO_BINDINGS;
import static org.apache.jackrabbit.oak.api.Type.STRINGS;
import static org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndexTest.createIndex;
@@ -44,7 +42,6 @@ import java.util.concurrent.Executors;
import javax.jcr.PropertyType;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.oak.InitialContent;
import org.apache.jackrabbit.oak.Oak;
@@ -213,13 +210,13 @@ public class MultiplexingLucenePropertyIndexTest extends AbstractQueryTest {
assertEquals(2, getIndexDirNames(idxName).size());
String barQuery = "select [jcr:path] from [nt:base] where [foo] = 'bar'";
- assertQuery(barQuery, of("/libs/a", "/content/a"));
+ assertQuery(barQuery, List.of("/libs/a", "/content/a"));
Result result = executeQuery(barQuery, SQL2, NO_BINDINGS);
assertTrue(result.getRows().iterator().hasNext());
assertEquals(2, result.getSize(Result.SizePrecision.FAST_APPROXIMATION, 100));
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar2'", of("/libs/b"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar2'", List.of("/libs/b"));
}
@Test
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/NodeStateAnalyzerFactoryTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/NodeStateAnalyzerFactoryTest.java
index c4ead1c3b1..e9a4f1365c 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/NodeStateAnalyzerFactoryTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/NodeStateAnalyzerFactoryTest.java
@@ -16,16 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.lang.reflect.Field;
+import java.util.List;
import java.util.Map;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.plugins.index.lucene.NodeStateAnalyzerFactory.NodeStateResourceLoader;
@@ -109,7 +108,7 @@ public class NodeStateAnalyzerFactoryTest {
nb.child(ANL_TOKENIZER).setProperty(ANL_NAME, "whitespace");
NodeBuilder filters = nb.child(ANL_FILTERS);
- filters.setProperty(OAK_CHILD_ORDER, ImmutableList.of("stop", "LowerCase"),NAMES);
+ filters.setProperty(OAK_CHILD_ORDER, List.of("stop", "LowerCase"),NAMES);
filters.child("LowerCase").setProperty(ANL_NAME, "LowerCase");
filters.child("LowerCase").setProperty(JCR_PRIMARYTYPE, "nt:unstructured");
//name is optional. Derived from nodeName
@@ -131,7 +130,7 @@ public class NodeStateAnalyzerFactoryTest {
nb.child(ANL_TOKENIZER).setProperty(ANL_NAME, "whitespace");
NodeBuilder filters = nb.child(ANL_CHAR_FILTERS);
- filters.setProperty(OAK_CHILD_ORDER, ImmutableList.of("htmlStrip", "mapping"),NAMES);
+ filters.setProperty(OAK_CHILD_ORDER, List.of("htmlStrip", "mapping"),NAMES);
filters.child("mapping").setProperty(ANL_NAME, "mapping");
filters.child("htmlStrip"); //name is optional. Derived from nodeName
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
index 05c4f12918..d588ad353f 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
@@ -38,7 +38,6 @@ import javax.management.MBeanServer;
import javax.management.ObjectName;
import ch.qos.logback.classic.Level;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
@@ -99,7 +98,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.guava.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.apache.jackrabbit.oak.api.QueryEngine.NO_BINDINGS;
import static org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider;
@@ -194,25 +192,25 @@ public class HybridIndexTest extends AbstractQueryTest {
runAsyncIndex();
setTraversalEnabled(false);
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a"));
//Add new node. This would not be reflected in result as local index would not be updated
createPath("/b").setProperty("foo", "bar");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a"));
//Now let some time elapse such that readers can be refreshed
clock.waitUntil(clock.getTime() + refreshDelta + 1);
//Now recently added stuff should be visible without async indexing run
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a", "/b"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a", "/b"));
createPath("/c").setProperty("foo", "bar");
root.commit();
//Post async index it should still be upto date
runAsyncIndex();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a", "/b", "/c"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a", "/b", "/c"));
}
@Test
@@ -262,7 +260,7 @@ public class HybridIndexTest extends AbstractQueryTest {
runAsyncIndex();
assertEquals(1, testBlob.accessCount);
- assertQuery("select * from [nt:base] where CONTAINS(*, 'sky')", of("/test/msg/jcr:content"));
+ assertQuery("select * from [nt:base] where CONTAINS(*, 'sky')", List.of("/test/msg/jcr:content"));
}
@@ -281,12 +279,12 @@ public class HybridIndexTest extends AbstractQueryTest {
runAsyncIndex();
setTraversalEnabled(false);
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a"));
//Add new node. This should get immediately reelected as its a sync index
createPath("/b").setProperty("foo", "bar");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a", "/b"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a", "/b"));
}
@Test
@@ -299,19 +297,19 @@ public class HybridIndexTest extends AbstractQueryTest {
createPath("/a").setProperty("foo", "bar");
root.commit();
setTraversalEnabled(false);
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a"));
//Add new node. This should get immediately reelected as its a sync index
createPath("/b").setProperty("foo", "bar");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a", "/b"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a", "/b"));
runAsyncIndex();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a", "/b"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a", "/b"));
createPath("/c").setProperty("foo", "bar");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a", "/b", "/c"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a", "/b", "/c"));
}
@Test
@@ -325,7 +323,7 @@ public class HybridIndexTest extends AbstractQueryTest {
createPath("/a").setProperty("foo", "bar");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a"));
optionalEditorProvider.delegate = new TypeEditorProvider(false);
NodeTypeRegistry.register(root, IOUtils.toInputStream(TestUtil.TEST_NODE_TYPE), "test nodeType");
@@ -335,7 +333,7 @@ public class HybridIndexTest extends AbstractQueryTest {
b.setProperty(JcrConstants.JCR_PRIMARYTYPE, "oak:TestNode", Type.NAME);
b.setProperty("bar", "foo");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [bar] = 'foo'", of("/b"));
+ assertQuery("select [jcr:path] from [nt:base] where [bar] = 'foo'", List.of("/b"));
}
@Test
@@ -354,7 +352,7 @@ public class HybridIndexTest extends AbstractQueryTest {
//such that it does not indexes test nodetype
Tree nodeType = root.getTree("/oak:index/nodetype");
if (!nodeType.hasProperty(IndexConstants.DECLARING_NODE_TYPES)){
- nodeType.setProperty(IndexConstants.DECLARING_NODE_TYPES, ImmutableList.of("nt:file"), Type.NAMES);
+ nodeType.setProperty(IndexConstants.DECLARING_NODE_TYPES, List.of("nt:file"), Type.NAMES);
nodeType.setProperty(IndexConstants.REINDEX_PROPERTY_NAME, true);
}
@@ -364,7 +362,7 @@ public class HybridIndexTest extends AbstractQueryTest {
createPath("/a").setProperty("foo", "bar");
root.commit();
- assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", of("/a"));
+ assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar'", List.of("/a"));
optionalEditorProvider.delegate = new TypeEditorProvider(false);
NodeTypeRegistry.register(root, IOUtils.toInputStream(TestUtil.TEST_NODE_TYPE), "test nodeType");
@@ -380,7 +378,7 @@ public class HybridIndexTest extends AbstractQueryTest {
String query = "select [jcr:path] from [oak:TestNode] ";
assertThat(explain(query), containsString("/oak:index/hybridtest"));
- assertQuery(query, of("/b", "/c"));
+ assertQuery(query, List.of("/b", "/c"));
}
@Test
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcherTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcherTest.java
index 3ddf24a5e3..d44271dba2 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcherTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcherTest.java
@@ -16,15 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene.property;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.state.EqualsDiff;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_HEAD_BUCKET;
import static org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_PREVIOUS_BUCKET;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
@@ -43,7 +42,7 @@ public class BucketSwitcherTest {
@Test
public void basic() throws Exception {
bs.switchBucket(100);
- assertThat(copyOf(bs.getOldBuckets()), empty());
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), empty());
}
@Test
@@ -52,7 +51,7 @@ public class BucketSwitcherTest {
builder.setProperty(PROP_HEAD_BUCKET, "1");
bs.switchBucket(100);
- assertThat(copyOf(bs.getOldBuckets()), empty());
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), empty());
}
@Test
@@ -65,7 +64,7 @@ public class BucketSwitcherTest {
bs.switchBucket(100);
assertFalse(builder.hasProperty(PROP_PREVIOUS_BUCKET));
assertEquals("2", builder.getString(PROP_HEAD_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1"));
}
@Test
@@ -81,7 +80,7 @@ public class BucketSwitcherTest {
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertTrue(builder.hasChildNode("3"));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1"));
}
@Test
@@ -96,7 +95,7 @@ public class BucketSwitcherTest {
bs.switchBucket(150);
assertFalse(builder.hasProperty(PROP_PREVIOUS_BUCKET));
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1", "2"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1", "2"));
}
/**
@@ -117,7 +116,7 @@ public class BucketSwitcherTest {
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertEquals("2", builder.getString(PROP_PREVIOUS_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1"));
NodeState state1 = builder.getNodeState();
assertFalse(bs.switchBucket(100));
@@ -126,7 +125,7 @@ public class BucketSwitcherTest {
//as previous
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertEquals("2", builder.getString(PROP_PREVIOUS_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1"));
NodeState state2 = builder.getNodeState();
assertFalse(bs.switchBucket(100));
@@ -134,7 +133,7 @@ public class BucketSwitcherTest {
//Async indexer time still not changed. So head bucket remains same
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertEquals("2", builder.getString(PROP_PREVIOUS_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1"));
NodeState state3 = builder.getNodeState();
@@ -159,7 +158,7 @@ public class BucketSwitcherTest {
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertEquals("2", builder.getString(PROP_PREVIOUS_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1"));
NodeState state1 = builder.getNodeState();
assertTrue(bs.switchBucket(150));
@@ -167,14 +166,14 @@ public class BucketSwitcherTest {
//This time previous bucket should be discarded
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertNull(builder.getString(PROP_PREVIOUS_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1", "2"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1", "2"));
NodeState state2 = builder.getNodeState();
assertTrue(bs.switchBucket(200));
assertEquals("3", builder.getString(PROP_HEAD_BUCKET));
assertNull(builder.getString(PROP_PREVIOUS_BUCKET));
- assertThat(copyOf(bs.getOldBuckets()), containsInAnyOrder("1", "2"));
+ assertThat(CollectionUtils.toList(bs.getOldBuckets()), containsInAnyOrder("1", "2"));
//assert no change done after previous is removed
//not even change of asyncIndexedTo
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookupTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookupTest.java
index 1ee37ff43f..99f4f8adab 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookupTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookupTest.java
@@ -16,13 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene.property;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexDefinitionBuilder;
import org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition;
import org.apache.jackrabbit.oak.plugins.index.search.PropertyDefinition;
@@ -108,7 +107,7 @@ public class HybridPropertyIndexLookupTest {
Iterable<String> paths = lookup.query(filter, propertyName,
filter.getPropertyRestriction(propertyName));
- assertThat(ImmutableList.copyOf(paths), containsInAnyOrder("/a"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("/a"));
}
@Test
@@ -128,14 +127,14 @@ public class HybridPropertyIndexLookupTest {
Iterable<String> paths = lookup.query(filter, propertyName,
filter.getPropertyRestriction(propertyName));
- assertThat(ImmutableList.copyOf(paths), containsInAnyOrder("/a"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("/a"));
lookup = new HybridPropertyIndexLookup(indexPath, builder.getNodeState(),
"/content", true);
paths = lookup.query(filter, propertyName,
filter.getPropertyRestriction(propertyName));
- assertThat(ImmutableList.copyOf(paths), containsInAnyOrder("/content/a"));
+ assertThat(CollectionUtils.toList(paths), containsInAnyOrder("/content/a"));
}
private void propertyUpdated(String nodePath, String propertyRelativeName, String value){
@@ -157,7 +156,7 @@ public class HybridPropertyIndexLookupTest {
HybridPropertyIndexLookup lookup = new HybridPropertyIndexLookup(indexPath, builder.getNodeState());
Iterable<String> paths = lookup.query(filter, propertyName,
filter.getPropertyRestriction(propertyRestrictionName));
- return ImmutableList.copyOf(paths);
+ return CollectionUtils.toList(paths);
}
private PropertyDefinition pd(String propName){
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexStorageTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexStorageTest.java
index e292ac1aa2..dc6640ea04 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexStorageTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexStorageTest.java
@@ -16,13 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene.property;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.PropertyValue;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexDefinitionBuilder;
import org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition;
import org.apache.jackrabbit.oak.plugins.index.search.PropertyDefinition;
@@ -205,7 +204,7 @@ public class HybridPropertyIndexStorageTest {
HybridPropertyIndexLookup lookup = new HybridPropertyIndexLookup(indexPath, builder.getNodeState());
FilterImpl filter = createFilter(root, "nt:base");
Iterable<String> paths = lookup.query(filter, propertyName, value);
- return ImmutableList.copyOf(paths);
+ return CollectionUtils.toList(paths);
}
private PropertyIndexUpdateCallback newCallback(){
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/PropertyIndexCleanerTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/PropertyIndexCleanerTest.java
index b8b89933bb..4ebc69def3 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/PropertyIndexCleanerTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/PropertyIndexCleanerTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene.property;
import java.util.HashMap;
@@ -24,9 +23,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.InitialContent;
import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo;
import org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService;
import org.apache.jackrabbit.oak.plugins.index.lucene.property.PropertyIndexCleaner.CleanupStats;
@@ -332,7 +331,7 @@ public class PropertyIndexCleanerTest {
HybridPropertyIndexLookup lookup = new HybridPropertyIndexLookup(indexPath, getNode(root, indexPath));
FilterImpl filter = FilterImpl.newTestInstance();
Iterable<String> paths = lookup.query(filter, propertyName, PropertyValues.newString(value));
- return ImmutableList.copyOf(paths);
+ return CollectionUtils.toList(paths);
}
private static class SimpleAsyncInfoService implements AsyncIndexInfoService {
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniqueIndexCleanerTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniqueIndexCleanerTest.java
index 9b33ff2e4f..fce3c81420 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniqueIndexCleanerTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniqueIndexCleanerTest.java
@@ -16,14 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.lucene.property;
-
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_CREATED;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
@@ -42,7 +40,7 @@ public class UniqueIndexCleanerTest {
UniqueIndexCleaner cleaner = new UniqueIndexCleaner(MILLISECONDS, 1);
cleaner.clean(builder, 10);
- assertThat(copyOf(builder.getChildNodeNames()), containsInAnyOrder("a", "b"));
+ assertThat(CollectionUtils.toList(builder.getChildNodeNames()), containsInAnyOrder("a", "b"));
}
@Test
@@ -53,7 +51,7 @@ public class UniqueIndexCleanerTest {
refresh();
UniqueIndexCleaner cleaner = new UniqueIndexCleaner(MILLISECONDS, 100);
cleaner.clean(builder, 200);
- assertThat(copyOf(builder.getChildNodeNames()), containsInAnyOrder("b"));
+ assertThat(CollectionUtils.toList(builder.getChildNodeNames()), containsInAnyOrder("b"));
}
private void refresh(){
diff --git a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/ChildNodeStateProviderTest.java b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/ChildNodeStateProviderTest.java
index 59f829c4a5..d558622065 100644
--- a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/ChildNodeStateProviderTest.java
+++ b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/ChildNodeStateProviderTest.java
@@ -26,11 +26,11 @@ import java.util.Set;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
@@ -60,17 +60,17 @@ public class ChildNodeStateProviderTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/c", "/a/d", "/e", "/e/f", "/g", "/h"));
ChildNodeStateProvider p = new ChildNodeStateProvider(citr, "/a", preferred);
- assertEquals(asList("jcr:content", "c", "d"), copyOf(childNames(p.children())));
+ assertEquals(asList("jcr:content", "c", "d"), CollectionUtils.toList(childNames(p.children())));
assertEquals(5, citr.getCount());
citr.reset();
p = new ChildNodeStateProvider(citr, "/e", preferred);
- assertEquals(singletonList("f"), copyOf(childNames(p.children())));
+ assertEquals(singletonList("f"), CollectionUtils.toList(childNames(p.children())));
assertEquals(7, citr.getCount());
p = new ChildNodeStateProvider(citr, "/g", preferred);
- assertEquals(emptyList(), copyOf(childNames(p.children())));
+ assertEquals(emptyList(), CollectionUtils.toList(childNames(p.children())));
}
@Test
@@ -79,22 +79,22 @@ public class ChildNodeStateProviderTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/b", "/a/b/c", "/a/b/c/d", "/e", "/e/f", "/g", "/h"));
ChildNodeStateProvider p = new ChildNodeStateProvider(citr, "/a", preferred);
- assertEquals(singletonList("b"), copyOf(childNames(p.children())));
+ assertEquals(singletonList("b"), CollectionUtils.toList(childNames(p.children())));
assertEquals(5, citr.getCount());
citr.reset();
p = new ChildNodeStateProvider(citr, "/a/b", preferred);
- assertEquals(singletonList("c"), copyOf(childNames(p.children())));
+ assertEquals(singletonList("c"), CollectionUtils.toList(childNames(p.children())));
assertEquals(5, citr.getCount());
p = new ChildNodeStateProvider(citr, "/a/b/c", preferred);
- assertEquals(singletonList("d"), copyOf(childNames(p.children())));
+ assertEquals(singletonList("d"), CollectionUtils.toList(childNames(p.children())));
p = new ChildNodeStateProvider(citr, "/a/b/c/d", preferred);
- assertEquals(emptyList(), copyOf(childNames(p.children())));
+ assertEquals(emptyList(), CollectionUtils.toList(childNames(p.children())));
p = new ChildNodeStateProvider(citr, "/h", preferred);
- assertEquals(emptyList(), copyOf(childNames(p.children())));
+ assertEquals(emptyList(), CollectionUtils.toList(childNames(p.children())));
}
@Test
@@ -152,7 +152,7 @@ public class ChildNodeStateProviderTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/c", "/a/d", "/e", "/e/f"));
ChildNodeStateProvider p = new ChildNodeStateProvider(citr, "/a", preferred);
- assertEquals(asList("jcr:content", "c", "d"), copyOf(childNames(p.children())));
+ assertEquals(asList("jcr:content", "c", "d"), CollectionUtils.toList(childNames(p.children())));
assertEquals(5, citr.getCount());
}
@@ -163,7 +163,7 @@ public class ChildNodeStateProviderTest {
"/a/c", "/a/c/status","/a/d", "/e", "/e/f"));
ChildNodeStateProvider p = new ChildNodeStateProvider(citr, "/a", preferred);
- assertEquals(asList("jcr:content", "c", "d"), copyOf(childNames(p.children())));
+ assertEquals(asList("jcr:content", "c", "d"), CollectionUtils.toList(childNames(p.children())));
assertEquals(7, citr.getCount());
}
diff --git a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/NodeStateEntryWriterTest.java b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/NodeStateEntryWriterTest.java
index ddfc6b1f1d..6b7c4e8fc3 100644
--- a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/NodeStateEntryWriterTest.java
+++ b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/NodeStateEntryWriterTest.java
@@ -16,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.index.indexer.document.flatfile;
import java.util.Arrays;
import java.util.List;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry;
import org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry.NodeStateEntryBuilder;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
@@ -32,7 +32,6 @@ import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
import static org.apache.jackrabbit.oak.index.indexer.document.flatfile.NodeStateEntryWriter.getPath;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
@@ -112,7 +111,7 @@ public class NodeStateEntryWriterTest {
NodeStateEntry e1 = new NodeStateEntryBuilder(b1.getNodeState(), "/a/b/c/d").build();
String json = nw.asJson(e1.getNodeState());
- List<String> pathElements = copyOf(elements(e1.getPath()));
+ List<String> pathElements = CollectionUtils.toList(elements(e1.getPath()));
String line = nw.toString(pathElements, json);
@@ -132,7 +131,7 @@ public class NodeStateEntryWriterTest {
NodeStateEntry e1 = new NodeStateEntryBuilder(b1.getNodeState(), "/").build();
String json = nw.asJson(e1.getNodeState());
- List<String> pathElements = copyOf(elements(e1.getPath()));
+ List<String> pathElements = CollectionUtils.toList(elements(e1.getPath()));
String line = nw.toString(pathElements, json);
@@ -154,9 +153,9 @@ public class NodeStateEntryWriterTest {
b.setProperty("foo1", "bar1");
String json2 = nw.asJson(b.getNodeState());
- String line1 = nw.toString(copyOf(elements("/")), json1);
- String line2 = nw.toString(copyOf(elements("/sub-node")), json1);
- String line3 = nw.toString(copyOf(elements("/sub-node")), json2);
+ String line1 = nw.toString(CollectionUtils.toList(elements("/")), json1);
+ String line2 = nw.toString(CollectionUtils.toList(elements("/sub-node")), json1);
+ String line3 = nw.toString(CollectionUtils.toList(elements("/sub-node")), json2);
NodeStateEntryReader nr = new NodeStateEntryReader(blobStore);
diff --git a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TestUtils.java b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TestUtils.java
index e9d5b483b5..66d831e8c6 100644
--- a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TestUtils.java
+++ b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TestUtils.java
@@ -19,6 +19,7 @@
package org.apache.jackrabbit.oak.index.indexer.document.flatfile;
import org.apache.jackrabbit.guava.common.collect.Iterables;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry;
import org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry.NodeStateEntryBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -29,7 +30,6 @@ import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static java.util.Collections.emptySet;
import static java.util.stream.Collectors.toList;
import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
@@ -51,7 +51,7 @@ public class TestUtils {
static List<String> sortPaths(List<String> paths, Comparator<Iterable<String>> comparator) {
List<Iterable<String>> copy = paths.stream()
- .map(p -> copyOf(elements(p)))
+ .map(p -> CollectionUtils.toList(elements(p)))
.sorted(comparator)
.collect(toList());
return copy.stream().map(e -> "/" + String.join("/", e)).collect(toList());
diff --git a/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionsCommandTest.java b/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionsCommandTest.java
index 3f2aad0865..30dd2c0750 100644
--- a/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionsCommandTest.java
+++ b/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionsCommandTest.java
@@ -20,10 +20,12 @@ package org.apache.jackrabbit.oak.plugins.document;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
import org.apache.jackrabbit.oak.run.RevisionsCommand;
import org.junit.Before;
@@ -409,11 +411,13 @@ public class RevisionsCommandTest {
private static class RevisionsCmd implements Runnable {
- private final ImmutableList<String> args;
+ private final List<String> args;
public RevisionsCmd(String... args) {
- this.args = ImmutableList.<String>builder().add(MongoUtils.URL)
- .add(args).build();
+ List<String> builder = new ArrayList<>();
+ builder.add(MongoUtils.URL);
+ builder.addAll(Arrays.asList(args));
+ this.args = Collections.unmodifiableList(builder);
}
@Override
diff --git a/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCheckTest.java b/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCheckTest.java
index dd4d8d5b90..fb5469f5d9 100644
--- a/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCheckTest.java
+++ b/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCheckTest.java
@@ -40,7 +40,6 @@ import java.util.Properties;
import java.util.Random;
import java.util.Set;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import joptsimple.internal.Strings;
@@ -201,7 +200,7 @@ public class DataStoreCheckTest {
Random rand = new Random();
String deletedBlobId = Iterables.get(blobsAdded, rand.nextInt(blobsAdded.size()));
blobsAdded.remove(deletedBlobId);
- long count = setupDataStore.countDeleteChunks(ImmutableList.of(deletedBlobId), 0);
+ long count = setupDataStore.countDeleteChunks(List.of(deletedBlobId), 0);
assertEquals(1, count);
setupDataStore.close();
@@ -222,7 +221,7 @@ public class DataStoreCheckTest {
blobsAdded.remove(deletedBlobId);
long count = setupDataStore
- .countDeleteChunks(ImmutableList.of(deletedBlobId),
+ .countDeleteChunks(List.of(deletedBlobId),
0);
assertEquals(1, count);
setupDataStore.close();
@@ -248,11 +247,11 @@ public class DataStoreCheckTest {
Random rand = new Random();
String deletedBlobId = Iterables.get(blobsAdded, rand.nextInt(blobsAdded.size()));
blobsAdded.remove(deletedBlobId);
- long count = setupDataStore.countDeleteChunks(ImmutableList.of(deletedBlobId), 0);
+ long count = setupDataStore.countDeleteChunks(List.of(deletedBlobId), 0);
String activeDeletedBlobId = Iterables.get(blobsAdded, rand.nextInt(blobsAdded.size()));
blobsAdded.remove(activeDeletedBlobId);
- count += setupDataStore.countDeleteChunks(ImmutableList.of(activeDeletedBlobId), 0);
+ count += setupDataStore.countDeleteChunks(List.of(activeDeletedBlobId), 0);
assertEquals(2, count);
// artificially put the deleted id in the tracked .del file
@@ -279,11 +278,11 @@ public class DataStoreCheckTest {
Random rand = new Random();
String deletedBlobId = Iterables.get(blobsAdded, rand.nextInt(blobsAdded.size()));
blobsAdded.remove(deletedBlobId);
- long count = setupDataStore.countDeleteChunks(ImmutableList.of(deletedBlobId), 0);
+ long count = setupDataStore.countDeleteChunks(List.of(deletedBlobId), 0);
String activeDeletedBlobId = Iterables.get(blobsAdded, rand.nextInt(blobsAdded.size()));
blobsAdded.remove(activeDeletedBlobId);
- count += setupDataStore.countDeleteChunks(ImmutableList.of(activeDeletedBlobId), 0);
+ count += setupDataStore.countDeleteChunks(List.of(activeDeletedBlobId), 0);
assertEquals(2, count);
// artificially put the deleted id in the tracked .del file
diff --git a/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCommandTest.java b/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCommandTest.java
index f0cc1d8d1f..f2d0fdda85 100644
--- a/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCommandTest.java
+++ b/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DataStoreCommandTest.java
@@ -42,7 +42,6 @@ import java.util.stream.StreamSupport;
import ch.qos.logback.classic.Level;
import org.apache.jackrabbit.guava.common.base.Splitter;
import org.apache.jackrabbit.guava.common.base.Strings;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.guava.common.collect.Maps;
@@ -258,7 +257,7 @@ public class DataStoreCommandTest {
}
for (String id : data.missingDataStore) {
- long count = blobStore.countDeleteChunks(ImmutableList.of(id), 0);
+ long count = blobStore.countDeleteChunks(List.of(id), 0);
assertEquals(1, count);
}
@@ -1341,11 +1340,11 @@ public class DataStoreCommandTest {
static class FixtureHelper {
static List<StoreFixture> getStoreFixtures() {
- return ImmutableList.of(StoreFixture.MONGO, StoreFixture.SEGMENT, StoreFixture.SEGMENT_AZURE);
+ return List.of(StoreFixture.MONGO, StoreFixture.SEGMENT, StoreFixture.SEGMENT_AZURE);
}
static List<DataStoreFixture> getDataStoreFixtures() {
- return ImmutableList.of(DataStoreFixture.S3, DataStoreFixture.AZURE, DataStoreFixture.FDS);
+ return List.of(DataStoreFixture.S3, DataStoreFixture.AZURE, DataStoreFixture.FDS);
}
static List<Object[]> get() {
diff --git a/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DocumentStoreCheckCommandTest.java b/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DocumentStoreCheckCommandTest.java
index 5083b29be6..c2963ec751 100644
--- a/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DocumentStoreCheckCommandTest.java
+++ b/oak-run/src/test/java/org/apache/jackrabbit/oak/run/DocumentStoreCheckCommandTest.java
@@ -21,8 +21,6 @@ import java.nio.file.Files;
import java.util.List;
import java.util.UUID;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.document.DocumentMKBuilderProvider;
@@ -237,7 +235,7 @@ public class DocumentStoreCheckCommandTest {
CommitHook hook = EmptyHook.INSTANCE;
if (withIndexUpdate) {
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
- IndexUtils.createIndexDefinition(index, "uuid", true, true, ImmutableList.of("jcr:uuid"), null);
+ IndexUtils.createIndexDefinition(index, "uuid", true, true, List.of("jcr:uuid"), null);
hook = new EditorHook(new IndexUpdateProvider(new PropertyIndexEditorProvider()));
}
ns.merge(builder, hook, CommitInfo.EMPTY);
diff --git a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexAndTraversalQueriesSimilarResultsCommonTest.java b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexAndTraversalQueriesSimilarResultsCommonTest.java
index 0b86a878cf..c3f871ba07 100644
--- a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexAndTraversalQueriesSimilarResultsCommonTest.java
+++ b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexAndTraversalQueriesSimilarResultsCommonTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder;
import org.apache.jackrabbit.oak.query.AbstractQueryTest;
@@ -78,14 +77,14 @@ public abstract class IndexAndTraversalQueriesSimilarResultsCommonTest extends A
* - The queries that have different results between traversal and the indexes, for the most part also produce
* different results between Elastic and Lucene.
*/
- protected List<String> queriesWithSameResults = ImmutableList.of(
+ protected List<String> queriesWithSameResults = List.of(
// Full-text queries
"/jcr:root//*[jcr:contains(@propa, '*')]",
"/jcr:root//*[jcr:contains(@propa, '123*')]",
"/jcr:root//*[jcr:contains(@propa, 'fal*')]"
);
- protected List<String> queriesWithDifferentResults = ImmutableList.of(
+ protected List<String> queriesWithDifferentResults = List.of(
"/jcr:root//*[@propa]",
"/jcr:root//*[@propa > 0]",
"/jcr:root//*[@propa > '0']",
diff --git a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexExclusionQueryCommonTest.java b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexExclusionQueryCommonTest.java
index a813ebe4c9..82c40abcd1 100644
--- a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexExclusionQueryCommonTest.java
+++ b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexExclusionQueryCommonTest.java
@@ -22,7 +22,6 @@ import org.junit.Test;
import java.util.List;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static javax.jcr.PropertyType.TYPENAME_BINARY;
import static javax.jcr.PropertyType.TYPENAME_STRING;
import static org.apache.jackrabbit.JcrConstants.JCR_LASTMODIFIED;
@@ -47,8 +46,8 @@ public abstract class IndexExclusionQueryCommonTest extends AbstractQueryTest {
protected void createTestIndexNode() throws Exception {
Tree index = createTestIndexNode(root.getTree("/"), indexOptions.getIndexType());
index.setProperty(INCLUDE_PROPERTY_TYPES,
- of(TYPENAME_BINARY, TYPENAME_STRING), STRINGS);
- index.setProperty(EXCLUDE_PROPERTY_NAMES, of(NOT_IN), STRINGS);
+ List.of(TYPENAME_BINARY, TYPENAME_STRING), STRINGS);
+ index.setProperty(EXCLUDE_PROPERTY_NAMES, List.of(NOT_IN), STRINGS);
TestUtil.useV2(index);
root.commit();
}
@@ -72,12 +71,12 @@ public abstract class IndexExclusionQueryCommonTest extends AbstractQueryTest {
+ " and (@" + JCR_LASTMODIFIED
+ " > xs:dateTime('2014-04-01T08:58:03.231Z')) ]";
- TestUtil.assertEventually(() -> assertQuery(query, "xpath", of("/content/two")), 3000 * 3);
+ TestUtil.assertEventually(() -> assertQuery(query, "xpath", List.of("/content/two")), 3000 * 3);
}
@Test
public void ignoreByName() throws Exception {
- final List<String> expected = of("/content/two");
+ final List<String> expected = List.of("/content/two");
Tree content = root.getTree("/").addChild("content");
Tree one = content.addChild("one");
@@ -117,7 +116,7 @@ public abstract class IndexExclusionQueryCommonTest extends AbstractQueryTest {
// Should not return /content/two since there, querty value is set for notincluded property which
// is part of excluded properties in the index definition
- TestUtil.assertEventually(() -> assertQuery(query, "xpath", of("/content/one")), 3000 * 3);
+ TestUtil.assertEventually(() -> assertQuery(query, "xpath", List.of("/content/one")), 3000 * 3);
}
@Test
@@ -138,7 +137,7 @@ public abstract class IndexExclusionQueryCommonTest extends AbstractQueryTest {
// Assert /content/two is not returned since it matches 2014 from DATE type property field which is not part of
// includePropertyTypes in the index definition
String query = "/jcr:root/content//*[jcr:contains(., '2014')]";
- TestUtil.assertEventually(() -> assertQuery(query, "xpath", of("/content/one")), 3000 * 3);
+ TestUtil.assertEventually(() -> assertQuery(query, "xpath", List.of("/content/one")), 3000 * 3);
}
}
diff --git a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexPlannerCommonTest.java b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexPlannerCommonTest.java
index ebba33eca4..e8a557e923 100644
--- a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexPlannerCommonTest.java
+++ b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/IndexPlannerCommonTest.java
@@ -19,7 +19,6 @@
package org.apache.jackrabbit.oak.plugins.index;
import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants;
@@ -104,7 +103,7 @@ public abstract class IndexPlannerCommonTest {
defn.setProperty(createProperty(ORDERED_PROP_NAMES, Set.of("foo"), STRINGS));
IndexNode node = createIndexNode(getIndexDefinition(root, defn.getNodeState(), "/oak:index/" + indexName));
FulltextIndexPlanner planner = getIndexPlanner(node, "/oak:index/" + indexName, createFilter("nt:base"),
- ImmutableList.of(new QueryIndex.OrderEntry("foo", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
+ List.of(new QueryIndex.OrderEntry("foo", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
assertNotNull(planner.getPlan());
assertTrue(pr(planner.getPlan()).isUniquePathsRequired());
}
@@ -114,7 +113,7 @@ public abstract class IndexPlannerCommonTest {
NodeBuilder defn = getPropertyIndexDefinitionNodeBuilder(builder, indexName, Set.of("foo"), "async");
IndexNode node = createIndexNode(getIndexDefinition(root, defn.getNodeState(), "/oak:index/" + indexName));
FulltextIndexPlanner planner = getIndexPlanner(node, "/oak:index/" + indexName, createFilter("nt:file"),
- ImmutableList.of(new QueryIndex.OrderEntry("jcr:score", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
+ List.of(new QueryIndex.OrderEntry("jcr:score", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
assertNull(planner.getPlan());
}
@@ -1158,7 +1157,7 @@ public abstract class IndexPlannerCommonTest {
TestUtil.assertEventually(() -> {
FulltextIndexPlanner planner = getIndexPlanner(node, "/oak:index/" + indexName, filter,
- ImmutableList.of(new QueryIndex.OrderEntry("bar", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
+ List.of(new QueryIndex.OrderEntry("bar", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
QueryIndex.IndexPlan plan = planner.getPlan();
assertNotNull(plan);
@@ -1184,7 +1183,7 @@ public abstract class IndexPlannerCommonTest {
TestUtil.assertEventually(() -> {
FulltextIndexPlanner planner = getIndexPlanner(node, "/oak:index/" + indexName, filter,
- ImmutableList.of(new QueryIndex.OrderEntry("bar", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
+ List.of(new QueryIndex.OrderEntry("bar", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
QueryIndex.IndexPlan plan = planner.getPlan();
assertNotNull(plan);
@@ -1338,7 +1337,7 @@ public abstract class IndexPlannerCommonTest {
TestUtil.assertEventually(() -> {
FulltextIndexPlanner planner = getIndexPlanner(node, "/oak:index/" + indexName, createFilter("nt:base"),
- ImmutableList.of(new QueryIndex.OrderEntry("foo", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING),
+ List.of(new QueryIndex.OrderEntry("foo", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING),
new QueryIndex.OrderEntry("bar", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
assertNotNull(planner.getPlan());
assertEquals(1, planner.getPlan().getEstimatedEntryCount());
@@ -1356,7 +1355,7 @@ public abstract class IndexPlannerCommonTest {
TestUtil.assertEventually(() -> {
FulltextIndexPlanner planner = getIndexPlanner(node, "/oak:index/" + indexName, createFilter("nt:base"),
- ImmutableList.of(new QueryIndex.OrderEntry("foo", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING),
+ List.of(new QueryIndex.OrderEntry("foo", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING),
new QueryIndex.OrderEntry("bar", Type.LONG, QueryIndex.OrderEntry.Order.ASCENDING)));
assertNotNull(planner.getPlan());
diff --git a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/search/AggregateTest.java b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/search/AggregateTest.java
index 38ac728f15..ab4936ef03 100644
--- a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/search/AggregateTest.java
+++ b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/search/AggregateTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.index.search;
import java.util.ArrayList;
@@ -42,7 +41,6 @@ import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.guava.common.collect.Iterables.toArray;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
@@ -71,7 +69,7 @@ public class AggregateTest {
@Test
public void oneLevelAll() {
- Aggregate ag = new Aggregate("nt:base", of(ni("*")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("*")));
NodeBuilder nb = newNode("nt:base");
nb.child("a").child("c");
nb.child("b");
@@ -83,7 +81,7 @@ public class AggregateTest {
@Test
public void oneLevelNamed() {
- Aggregate ag = new Aggregate("nt:base", of(ni("a")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("a")));
NodeBuilder nb = newNode("nt:base");
nb.child("a");
nb.child("b");
@@ -95,7 +93,7 @@ public class AggregateTest {
@Test
public void noOfChildNodeRead() {
- Aggregate ag = new Aggregate("nt:base", of(ni("a")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("a")));
NodeBuilder nb = newNode("nt:base");
nb.child("a");
for (int i = 0; i < 10; i++) {
@@ -119,7 +117,7 @@ public class AggregateTest {
@Test
public void oneLevelTyped() {
- Aggregate ag = new Aggregate("nt:base", of(ni("nt:resource","*", false)));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("nt:resource","*", false)));
NodeBuilder nb = newNode("nt:base");
nb.child("a").setProperty(JCR_PRIMARYTYPE,"nt:resource");
nb.child("b");
@@ -131,7 +129,7 @@ public class AggregateTest {
@Test
public void oneLevelTypedMixin() {
- Aggregate ag = new Aggregate("nt:base", of(ni("mix:title","*", false)));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("mix:title","*", false)));
NodeBuilder nb = newNode("nt:base");
nb.child("a").setProperty(JcrConstants.JCR_MIXINTYPES, Collections.singleton("mix:title"), Type.NAMES);
nb.child("b");
@@ -143,7 +141,7 @@ public class AggregateTest {
@Test
public void multiLevelAll() {
- Aggregate ag = new Aggregate("nt:base", of(ni("*"), ni("*/*")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("*"), ni("*/*")));
NodeBuilder nb = newNode("nt:base");
nb.child("a").child("c");
nb.child("b");
@@ -156,7 +154,7 @@ public class AggregateTest {
@Test
public void multiLevelNamed() {
- Aggregate ag = new Aggregate("nt:base", of(ni("a"), ni("d/e")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("a"), ni("d/e")));
NodeBuilder nb = newNode("nt:base");
nb.child("a").child("c");
nb.child("b");
@@ -169,7 +167,7 @@ public class AggregateTest {
@Test
public void multiLevelTyped() {
- Aggregate ag = new Aggregate("nt:base", of(ni("a"),
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("a"),
ni("nt:resource", "d/*/*", false)));
NodeBuilder nb = newNode("nt:base");
nb.child("a").child("c");
@@ -185,7 +183,7 @@ public class AggregateTest {
@Test
public void multiLevelNamedSubAll() {
- Aggregate ag = new Aggregate("nt:base", of(ni("a"), ni("d/*/*")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("a"), ni("d/*/*")));
NodeBuilder nb = newNode("nt:base");
nb.child("a").child("c");
nb.child("b");
@@ -202,9 +200,9 @@ public class AggregateTest {
@Test
public void multiAggregateMapping() {
- Aggregate ag = new Aggregate("nt:base", of(ni("*")));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni("*")));
- Aggregate agFile = new Aggregate("nt:file", of(ni("*"), ni("*/*")));
+ Aggregate agFile = new Aggregate("nt:file", List.of(ni("*"), ni("*/*")));
mapper.add("nt:file", agFile);
NodeBuilder nb = newNode("nt:base");
@@ -220,7 +218,7 @@ public class AggregateTest {
@Test
public void recursionEnabled() {
- Aggregate agFile = new Aggregate("nt:file", of(ni("*")), 5);
+ Aggregate agFile = new Aggregate("nt:file", List.of(ni("*")), 5);
mapper.add("nt:file", agFile);
NodeBuilder nb = newNode("nt:file");
@@ -237,7 +235,7 @@ public class AggregateTest {
@Test
public void recursionEnabledWithLimitCheck() {
int limit = 5;
- Aggregate agFile = new Aggregate("nt:file", of(ni("*")), limit);
+ Aggregate agFile = new Aggregate("nt:file", List.of(ni("*")), limit);
mapper.add("nt:file", agFile);
List<String> expectedPaths = new ArrayList<>();
@@ -265,12 +263,12 @@ public class AggregateTest {
@Test
public void includeMatches() {
- Aggregate ag = new Aggregate("nt:base", of(ni(null, "*", true), ni(null, "*/*", true)));
+ Aggregate ag = new Aggregate("nt:base", List.of(ni(null, "*", true), ni(null, "*/*", true)));
assertTrue(ag.hasRelativeNodeInclude("foo"));
assertTrue(ag.hasRelativeNodeInclude("foo/bar"));
assertFalse(ag.hasRelativeNodeInclude("foo/bar/baz"));
- Aggregate ag2 = new Aggregate("nt:base", of(ni(null, "foo", true), ni(null, "foo/*", true)));
+ Aggregate ag2 = new Aggregate("nt:base", List.of(ni(null, "foo", true), ni(null, "foo/*", true)));
assertTrue(ag2.hasRelativeNodeInclude("foo"));
assertFalse(ag2.hasRelativeNodeInclude("bar"));
assertTrue(ag2.hasRelativeNodeInclude("foo/bar"));
@@ -281,9 +279,9 @@ public class AggregateTest {
public void testReaggregate() {
//Enable relative include for all child nodes of nt:folder
//So indexing would create fulltext field for each relative nodes
- Aggregate agFolder = new Aggregate("nt:folder", of(ni("nt:file", "*", true)));
+ Aggregate agFolder = new Aggregate("nt:folder", List.of(ni("nt:file", "*", true)));
- Aggregate agFile = new Aggregate("nt:file", of(ni(null, "jcr:content", true)));
+ Aggregate agFile = new Aggregate("nt:file", List.of(ni(null, "jcr:content", true)));
mapper.add("nt:file", agFile);
mapper.add("nt:folder", agFolder);
@@ -312,9 +310,9 @@ public class AggregateTest {
//Enable relative include for all child nodes of nt:folder
//So indexing would create fulltext field for each relative nodes
- Aggregate agFolder = new Aggregate("nt:folder", of(ni("mix:title", "*", true)));
+ Aggregate agFolder = new Aggregate("nt:folder", List.of(ni("mix:title", "*", true)));
- Aggregate agFile = new Aggregate("mix:title", of(ni(null, "jcr:content", true)));
+ Aggregate agFile = new Aggregate("mix:title", List.of(ni(null, "jcr:content", true)));
mapper.add("mix:title", agFile);
mapper.add("nt:folder", agFolder);
@@ -338,7 +336,7 @@ public class AggregateTest {
public void testRelativeNodeInclude() {
//Enable relative include for all child nodes of nt:folder
//So indexing would create fulltext field for each relative nodes
- Aggregate agContent = new Aggregate("app:Page", of(ni(null, "jcr:content", true)));
+ Aggregate agContent = new Aggregate("app:Page", List.of(ni(null, "jcr:content", true)));
mapper.add("app:Page", agContent);
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/plugins/tree/TreeUtilTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/plugins/tree/TreeUtilTest.java
index 79f9ce11c5..d84e973f25 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/plugins/tree/TreeUtilTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/plugins/tree/TreeUtilTest.java
@@ -16,9 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.tree;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -310,7 +308,7 @@ public class TreeUtilTest extends AbstractTreeTest {
Tree parent = when(mockTree("/some/tree", true).addChild("name")).thenReturn(t).getMock();
when(ntDef.getProperty(JCR_HASORDERABLECHILDNODES)).thenReturn(PropertyStates.createProperty(JCR_HASORDERABLECHILDNODES, true, Type.BOOLEAN));
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithoutChildren);
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithoutChildren);
@@ -328,10 +326,10 @@ public class TreeUtilTest extends AbstractTreeTest {
Tree defWithChild = mock(Tree.class);
when(defWithChild.getProperty(JCR_DEFAULTPRIMARYTYPE)).thenReturn(PropertyStates.createProperty(JCR_DEFAULTPRIMARYTYPE, NT_OAK_UNSTRUCTURED, Type.NAME));
when(defWithChild.getChild("name")).thenReturn(defWithChild);
- when(defWithChild.getChildren()).thenReturn(ImmutableList.of(defWithChild));
+ when(defWithChild.getChildren()).thenReturn(List.of(defWithChild));
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithChild);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithoutChildren);
when(ntDef.getProperty(JCR_IS_ABSTRACT)).thenReturn(PropertyStates.createProperty(JCR_IS_ABSTRACT, true, Type.BOOLEAN));
@@ -418,7 +416,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAddMixinSuPrimary() throws Exception {
when(ntDef.getProperty(JCR_ISMIXIN)).thenReturn(PropertyStates.createProperty(JCR_ISMIXIN, true, Type.BOOLEAN));
- when(ntDef.getProperty(REP_PRIMARY_SUBTYPES)).thenReturn(PropertyStates.createProperty(REP_PRIMARY_SUBTYPES, ImmutableList.of(NT_OAK_UNSTRUCTURED), Type.NAMES));
+ when(ntDef.getProperty(REP_PRIMARY_SUBTYPES)).thenReturn(PropertyStates.createProperty(REP_PRIMARY_SUBTYPES, List.of(NT_OAK_UNSTRUCTURED), Type.NAMES));
when(typeRoot.getChild("containsSubPrimary")).thenReturn(ntDef);
TreeUtil.addMixin(child, "containsSubPrimary", typeRoot, "userId");
@@ -430,7 +428,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAddMixinSubMixin() throws Exception {
when(ntDef.getProperty(JCR_ISMIXIN)).thenReturn(PropertyStates.createProperty(JCR_ISMIXIN, true, Type.BOOLEAN));
- when(ntDef.getProperty(REP_MIXIN_SUBTYPES)).thenReturn(PropertyStates.createProperty(REP_MIXIN_SUBTYPES, ImmutableList.of(MIX_VERSIONABLE), Type.NAMES));
+ when(ntDef.getProperty(REP_MIXIN_SUBTYPES)).thenReturn(PropertyStates.createProperty(REP_MIXIN_SUBTYPES, List.of(MIX_VERSIONABLE), Type.NAMES));
when(typeRoot.getChild("containsSubMixin")).thenReturn(ntDef);
TreeUtil.addMixin(child, "containsSubMixin", typeRoot, "userId");
@@ -441,7 +439,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAddMixin() throws Exception {
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getProperty(JCR_ISMIXIN)).thenReturn(PropertyStates.createProperty(JCR_ISMIXIN, true, Type.BOOLEAN));
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithoutChildren);
@@ -457,8 +455,8 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAutoCreateItemsNoAutoCreateDefs() throws Exception {
Tree noAutoCreate = when(mockTree("/definitions/definition/notAutoCreate", true).getProperty(JCR_AUTOCREATED)).thenReturn(PropertyStates.createProperty(JCR_AUTOCREATED, false)).getMock();
- Tree defWithChildren = when(mockTree("/definitions/definition", true).getChildren()).thenReturn(ImmutableList.of(noAutoCreate)).getMock();
- Tree definitions = when(mockTree("/definitions", true).getChildren()).thenReturn(ImmutableList.of(defWithChildren)).getMock();
+ Tree defWithChildren = when(mockTree("/definitions/definition", true).getChildren()).thenReturn(List.of(noAutoCreate)).getMock();
+ Tree definitions = when(mockTree("/definitions", true).getChildren()).thenReturn(List.of(defWithChildren)).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(definitions);
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(definitions);
@@ -471,13 +469,13 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAutoCreateItemsExcludedProperties() throws Exception {
- List<Tree> list = ImmutableList.of(
+ List<Tree> list = List.of(
mockTree("/some/path/"+ REP_PRIMARY_TYPE, true),
mockTree("/some/path/" + REP_MIXIN_TYPES, true));
Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(list).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithExcludedProperties);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithoutChildren);
TreeUtil.autoCreateItems(child, ntDef, typeRoot, "userId");
@@ -490,11 +488,11 @@ public class TreeUtilTest extends AbstractTreeTest {
public void testAutoCreateItemsExistingUuid() throws Exception {
Tree definition = when(mock(Tree.class).getProperty(JCR_AUTOCREATED)).thenReturn(PropertyStates.createProperty(JCR_AUTOCREATED, true)).getMock();
Tree definitions = mockTree("/some/path/"+ REP_UUID, true);
- when(definitions.getChildren()).thenReturn(ImmutableList.of(definition));
- Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(definitions)).getMock();
+ when(definitions.getChildren()).thenReturn(List.of(definition));
+ Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(List.of(definitions)).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithExcludedProperties);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithoutChildren);
when(child.hasProperty(JCR_UUID)).thenReturn(true);
@@ -509,11 +507,11 @@ public class TreeUtilTest extends AbstractTreeTest {
public void testAutoCreateItemsMissingUuid() throws Exception {
Tree definition = when(mock(Tree.class).getProperty(JCR_AUTOCREATED)).thenReturn(PropertyStates.createProperty(JCR_AUTOCREATED, true)).getMock();
Tree definitions = mockTree("/some/path/"+ REP_UUID, true);
- when(definitions.getChildren()).thenReturn(ImmutableList.of(definition));
- Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(definitions)).getMock();
+ when(definitions.getChildren()).thenReturn(List.of(definition));
+ Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(List.of(definitions)).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithExcludedProperties);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithoutChildren);
when(child.hasProperty(JCR_UUID)).thenReturn(false);
@@ -528,11 +526,11 @@ public class TreeUtilTest extends AbstractTreeTest {
public void testAutoCreateItemsMissingDefaultValue() throws Exception {
Tree definition = when(mock(Tree.class).getProperty(JCR_AUTOCREATED)).thenReturn(PropertyStates.createProperty(JCR_AUTOCREATED, true)).getMock();
Tree definitions = mockTree("/some/path/unknownProperty", true);
- when(definitions.getChildren()).thenReturn(ImmutableList.of(definition));
- Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(definitions)).getMock();
+ when(definitions.getChildren()).thenReturn(List.of(definition));
+ Tree defWithExcludedProperties = when(mock(Tree.class).getChildren()).thenReturn(List.of(definitions)).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithExcludedProperties);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithoutChildren);
when(child.hasProperty("unknownProperty")).thenReturn(false);
@@ -543,12 +541,12 @@ public class TreeUtilTest extends AbstractTreeTest {
public void testAutoCreateItemsExistingChild() throws Exception {
Tree definition = when(mock(Tree.class).getProperty(JCR_AUTOCREATED)).thenReturn(PropertyStates.createProperty(JCR_AUTOCREATED, true)).getMock();
Tree definitions = mockTree("/some/path/autoChild", true);
- when(definitions.getChildren()).thenReturn(ImmutableList.of(definition));
+ when(definitions.getChildren()).thenReturn(List.of(definition));
- Tree defWithAutoChild = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(definitions)).getMock();
+ Tree defWithAutoChild = when(mock(Tree.class).getChildren()).thenReturn(List.of(definitions)).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithAutoChild);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithoutChildren);
when(child.hasChild("autoChild")).thenReturn(true);
@@ -565,12 +563,12 @@ public class TreeUtilTest extends AbstractTreeTest {
when(definition.getProperty(JCR_DEFAULTPRIMARYTYPE)).thenReturn(PropertyStates.createProperty(JCR_DEFAULTPRIMARYTYPE, NT_OAK_UNSTRUCTURED, Type.NAME));
Tree definitions = mockTree("/some/path/autoChild", true);
- when(definitions.getChildren()).thenReturn(ImmutableList.of(definition));
+ when(definitions.getChildren()).thenReturn(List.of(definition));
- Tree defWithAutoChild = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(definitions)).getMock();
+ Tree defWithAutoChild = when(mock(Tree.class).getChildren()).thenReturn(List.of(definitions)).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(defWithAutoChild);
- Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree defWithoutChildren = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
when(ntDef.getChild(REP_NAMED_PROPERTY_DEFINITIONS)).thenReturn(defWithoutChildren);
Tree newChild = mock(Tree.class);
@@ -606,7 +604,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAutoCreatePropertyFromDefaultValues() {
- PropertyState defaultSingleValue = PropertyStates.createProperty(JCR_DEFAULTVALUES, ImmutableList.of(34L), Type.LONGS);
+ PropertyState defaultSingleValue = PropertyStates.createProperty(JCR_DEFAULTVALUES, List.of(34L), Type.LONGS);
when(propDef.getProperty(JCR_DEFAULTVALUES)).thenReturn(defaultSingleValue);
when(propDef.getProperty(JCR_MULTIPLE)).thenReturn(PropertyStates.createProperty(JCR_MULTIPLE, false));
@@ -619,7 +617,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAutoCreatePropertyFromEmptyDefaultValues() {
- PropertyState defaultSingleValue = PropertyStates.createProperty(JCR_DEFAULTVALUES, ImmutableList.of(), Type.DATES);
+ PropertyState defaultSingleValue = PropertyStates.createProperty(JCR_DEFAULTVALUES, List.of(), Type.DATES);
when(propDef.getProperty(JCR_DEFAULTVALUES)).thenReturn(defaultSingleValue);
when(propDef.getProperty(JCR_MULTIPLE)).thenReturn(PropertyStates.createProperty(JCR_MULTIPLE, false));
@@ -629,7 +627,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testAutoCreatePropertyFromMvDefaultValues() {
- PropertyState defaultMvValue = PropertyStates.createProperty(JCR_DEFAULTVALUES, ImmutableList.of(true, false, true), Type.BOOLEANS);
+ PropertyState defaultMvValue = PropertyStates.createProperty(JCR_DEFAULTVALUES, List.of(true, false, true), Type.BOOLEANS);
when(propDef.getProperty(JCR_DEFAULTVALUES)).thenReturn(defaultMvValue);
when(propDef.getProperty(JCR_MULTIPLE)).thenReturn(PropertyStates.createProperty(JCR_MULTIPLE, true));
@@ -643,7 +641,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testGetDefaultChildTypeFromNamed() {
Tree def = mock(Tree.class);
- Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(def)).getMock();
+ Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(List.of(def)).getMock();
PropertyState ps = PropertyStates.createProperty(JCR_DEFAULTPRIMARYTYPE, NT_RESOURCE, Type.NAME);
when(def.getProperty(JCR_DEFAULTPRIMARYTYPE)).thenReturn(ps);
PropertyState sns = PropertyStates.createProperty(JCR_SAMENAMESIBLINGS, false, Type.BOOLEAN);
@@ -652,7 +650,7 @@ public class TreeUtilTest extends AbstractTreeTest {
Tree named = when(mock(Tree.class).getChild("newChild")).thenReturn(definitions).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(named);
- Tree emptyDefinitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(def)).getMock();
+ Tree emptyDefinitions = when(mock(Tree.class).getChildren()).thenReturn(List.of(def)).getMock();
when(ntDef.getChild(REP_RESIDUAL_CHILD_NODE_DEFINITIONS)).thenReturn(emptyDefinitions);
assertEquals(NT_RESOURCE, TreeUtil.getDefaultChildType(typeRoot, child, "newChild"));
@@ -662,7 +660,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testGetDefaultChildTypeFromNamedWithSns() {
Tree def = mock(Tree.class);
- Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(def)).getMock();
+ Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(List.of(def)).getMock();
PropertyState ps = PropertyStates.createProperty(JCR_DEFAULTPRIMARYTYPE, NT_RESOURCE, Type.NAME);
when(def.getProperty(JCR_DEFAULTPRIMARYTYPE)).thenReturn(ps);
PropertyState sns = PropertyStates.createProperty(JCR_SAMENAMESIBLINGS, true, Type.BOOLEAN);
@@ -677,7 +675,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testGetDefaultChildTypeFromResidual() {
- Tree emptyDefinitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree emptyDefinitions = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
Tree named = when(mock(Tree.class).getChild("newChild")).thenReturn(emptyDefinitions).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(named);
@@ -686,7 +684,7 @@ public class TreeUtilTest extends AbstractTreeTest {
when(def.getProperty(JCR_DEFAULTPRIMARYTYPE)).thenReturn(ps);
PropertyState sns = PropertyStates.createProperty(JCR_SAMENAMESIBLINGS, false, Type.BOOLEAN);
when(def.getProperty(JCR_SAMENAMESIBLINGS)).thenReturn(sns);
- Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(def)).getMock();
+ Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(List.of(def)).getMock();
when(ntDef.getChild(REP_RESIDUAL_CHILD_NODE_DEFINITIONS)).thenReturn(definitions);
assertEquals(NT_RESOURCE, TreeUtil.getDefaultChildType(typeRoot, child, "newChild"));
@@ -695,7 +693,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testGetDefaultChildTypeFromResidualSns() {
- Tree emptyDefinitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of()).getMock();
+ Tree emptyDefinitions = when(mock(Tree.class).getChildren()).thenReturn(List.of()).getMock();
Tree named = when(mock(Tree.class).getChild("newChild")).thenReturn(emptyDefinitions).getMock();
when(ntDef.getChild(REP_NAMED_CHILD_NODE_DEFINITIONS)).thenReturn(named);
@@ -704,7 +702,7 @@ public class TreeUtilTest extends AbstractTreeTest {
when(def.getProperty(JCR_DEFAULTPRIMARYTYPE)).thenReturn(ps);
PropertyState sns = PropertyStates.createProperty(JCR_SAMENAMESIBLINGS, true, Type.BOOLEAN);
when(def.getProperty(JCR_SAMENAMESIBLINGS)).thenReturn(sns);
- Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(def)).getMock();
+ Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(List.of(def)).getMock();
when(ntDef.getChild(REP_RESIDUAL_CHILD_NODE_DEFINITIONS)).thenReturn(definitions);
assertEquals(NT_RESOURCE, TreeUtil.getDefaultChildType(typeRoot, child, "newChild"));
@@ -718,25 +716,25 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testGetEffectiveTypeNoMixins() {
- assertEquals(ImmutableList.of(ntDef), TreeUtil.getEffectiveType(z, typeRoot));
+ assertEquals(List.of(ntDef), TreeUtil.getEffectiveType(z, typeRoot));
}
@Test
public void testGetEffectiveType() {
- assertEquals(ImmutableList.of(ntDef, ntDef, ntDef), TreeUtil.getEffectiveType(child, typeRoot));
+ assertEquals(List.of(ntDef, ntDef, ntDef), TreeUtil.getEffectiveType(child, typeRoot));
}
@Test
public void testGetEffectiveTypeNonExistingPrimaryDef() {
- assertEquals(ImmutableList.of(), TreeUtil.getEffectiveType(mockTree("/anotherTree", rootTree, false, "rep:NonExistingType"), typeRoot));
+ assertEquals(List.of(), TreeUtil.getEffectiveType(mockTree("/anotherTree", rootTree, false, "rep:NonExistingType"), typeRoot));
}
@Test
public void testGetEffectiveTypeNonExistingMixinDef() {
Tree tree = mockTree("/anotherTree", rootTree, false);
- when(tree.getProperty(JCR_MIXINTYPES)).thenReturn(PropertyStates.createProperty(JCR_MIXINTYPES, ImmutableList.of("rep:NonExistingType"), Type.NAMES));
+ when(tree.getProperty(JCR_MIXINTYPES)).thenReturn(PropertyStates.createProperty(JCR_MIXINTYPES, List.of("rep:NonExistingType"), Type.NAMES));
- assertEquals(ImmutableList.of(), TreeUtil.getEffectiveType(tree, typeRoot));
+ assertEquals(List.of(), TreeUtil.getEffectiveType(tree, typeRoot));
}
@Test
@@ -748,7 +746,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testFindDefaultPrimaryType() {
Tree def = mock(Tree.class);
- Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(ImmutableList.of(def)).getMock();
+ Tree definitions = when(mock(Tree.class).getChildren()).thenReturn(List.of(def)).getMock();
assertNull(TreeUtil.findDefaultPrimaryType(definitions, false));
assertNull(TreeUtil.findDefaultPrimaryType(definitions, true));
@@ -782,7 +780,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testIsNodeTypeContainedInSupertypes() {
- PropertyState supertypes = PropertyStates.createProperty(REP_SUPERTYPES, ImmutableList.of(NT_BASE), Type.NAMES);
+ PropertyState supertypes = PropertyStates.createProperty(REP_SUPERTYPES, List.of(NT_BASE), Type.NAMES);
when(ntDef.getProperty(REP_SUPERTYPES)).thenReturn(supertypes);
assertTrue(TreeUtil.isNodeType(child, NT_BASE, typeRoot));
@@ -797,7 +795,7 @@ public class TreeUtilTest extends AbstractTreeTest {
@Test
public void testIsNodeTypeMixinContainedInSupertypes() {
- PropertyState supertypes = PropertyStates.createProperty(REP_SUPERTYPES, ImmutableList.of(MIX_REFERENCEABLE), Type.NAMES);
+ PropertyState supertypes = PropertyStates.createProperty(REP_SUPERTYPES, List.of(MIX_REFERENCEABLE), Type.NAMES);
when(ntDef.getProperty(REP_SUPERTYPES)).thenReturn(supertypes);
PropertyState mixinNames = PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, List.of(JcrConstants.MIX_VERSIONABLE), Type.NAMES);
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/CompositeConfigurationTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/CompositeConfigurationTest.java
index 20e0a06213..78e8037880 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/CompositeConfigurationTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/CompositeConfigurationTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.plugins.tree.RootProvider;
import org.apache.jackrabbit.oak.plugins.tree.TreeProvider;
@@ -251,7 +250,7 @@ public class CompositeConfigurationTest extends AbstractCompositeConfigurationTe
@NotNull
@Override
public List<ProtectedItemImporter> getProtectedItemImporters() {
- return ImmutableList.of(mock(ProtectedItemImporter.class));
+ return List.of(mock(ProtectedItemImporter.class));
}
};
addConfiguration(withImporter);
@@ -270,7 +269,7 @@ public class CompositeConfigurationTest extends AbstractCompositeConfigurationTe
@NotNull
@Override
public List<ThreeWayConflictHandler> getConflictHandlers() {
- return ImmutableList.of(mock(ThreeWayConflictHandler.class));
+ return List.of(mock(ThreeWayConflictHandler.class));
}
};
addConfiguration(withConflictHandler);
@@ -289,7 +288,7 @@ public class CompositeConfigurationTest extends AbstractCompositeConfigurationTe
@NotNull
@Override
public List<? extends CommitHook> getCommitHooks(@NotNull String workspaceName) {
- return ImmutableList.of(mock(CommitHook.class));
+ return List.of(mock(CommitHook.class));
}
};
addConfiguration(withCommitHook);
@@ -308,7 +307,7 @@ public class CompositeConfigurationTest extends AbstractCompositeConfigurationTe
@NotNull
@Override
public List<? extends ValidatorProvider> getValidators(@NotNull String workspaceName, @NotNull Set<Principal> principals, @NotNull MoveTracker moveTracker) {
- return ImmutableList.of(mock(ValidatorProvider.class));
+ return List.of(mock(ValidatorProvider.class));
}
};
addConfiguration(withValidator);
@@ -402,7 +401,7 @@ public class CompositeConfigurationTest extends AbstractCompositeConfigurationTe
@NotNull
@Override
public Iterable<Monitor<?>> getMonitors(@NotNull StatisticsProvider statisticsProvider) {
- return ImmutableList.of(monitor);
+ return List.of(monitor);
}
};
addConfiguration(withMonitors);
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProviderTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProviderTest.java
index 16c53ce070..7b2830201e 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProviderTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProviderTest.java
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.token;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Before;
@@ -26,6 +24,7 @@ import org.junit.Test;
import javax.jcr.Credentials;
import javax.jcr.GuestCredentials;
import javax.jcr.SimpleCredentials;
+import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertFalse;
@@ -58,7 +57,7 @@ public class CompositeTokenProviderTest {
public void testNullProvider() {
TokenProvider tp = CompositeTokenProvider.newInstance();
- assertSame(tp, CompositeTokenProvider.newInstance(ImmutableList.<TokenProvider>of()));
+ assertSame(tp, CompositeTokenProvider.newInstance(List.of()));
Credentials creds = new Credentials() {};
@@ -82,7 +81,7 @@ public class CompositeTokenProviderTest {
TokenProvider tp = CompositeTokenProvider.newInstance(base);
assertSame(base, tp);
- assertSame(base, CompositeTokenProvider.newInstance(ImmutableList.of(base)));
+ assertSame(base, CompositeTokenProvider.newInstance(List.of(base)));
}
@Test
@@ -93,7 +92,7 @@ public class CompositeTokenProviderTest {
@Test
public void testCreateCompositeProviderFromList() {
TokenProvider base = mock(TokenProvider.class);
- TokenProvider tp = CompositeTokenProvider.newInstance(ImmutableList.of(base, base));
+ TokenProvider tp = CompositeTokenProvider.newInstance(List.of(base, base));
assertTrue(tp instanceof CompositeTokenProvider);
}
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/ACETest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/ACETest.java
index bf051f79d4..356f1567e4 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/ACETest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/ACETest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
import org.apache.jackrabbit.api.security.authorization.PrivilegeCollection;
@@ -43,7 +42,9 @@ import javax.jcr.ValueFormatException;
import javax.jcr.security.AccessControlException;
import javax.jcr.security.Privilege;
import java.security.Principal;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
import static org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants.JCR_READ;
@@ -105,7 +106,7 @@ public class ACETest extends AbstractAccessControlTest {
}
private Restriction createRestriction(String name, Value[] values) throws Exception {
- return new RestrictionImpl(PropertyStates.createProperty(name, ImmutableList.copyOf(values)), false);
+ return new RestrictionImpl(PropertyStates.createProperty(name, Arrays.asList(values)), false);
}
@Test
@@ -216,7 +217,7 @@ public class ACETest extends AbstractAccessControlTest {
@Test
public void testRestrictions() {
Restriction r = new RestrictionImpl(PropertyStates.createProperty("r", "v"), false);
- Restriction r2 = new RestrictionImpl(PropertyStates.createProperty("r2", ImmutableList.of("v"), Type.STRINGS), false);
+ Restriction r2 = new RestrictionImpl(PropertyStates.createProperty("r2", List.of("v"), Type.STRINGS), false);
Set<Restriction> restrictions = Set.of(r, r2);
ACE ace = mockACE(testPrincipal, PrivilegeBits.BUILT_IN.get(JCR_READ), true, restrictions);
assertFalse(ace.getRestrictions().isEmpty());
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlListTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlListTest.java
index 39c60303c0..fa2aa9b85b 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlListTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlListTest.java
@@ -28,7 +28,6 @@ import javax.jcr.RepositoryException;
import javax.jcr.Value;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
@@ -134,7 +133,7 @@ public class AbstractAccessControlListTest extends AbstractAccessControlTest {
@Test
public void testGetNamePathMapper() {
assertSame(getNamePathMapper(), createEmptyACL().getNamePathMapper());
- assertSame(NamePathMapper.DEFAULT, createACL(getTestPath(), ImmutableList.<JackrabbitAccessControlEntry>of(), NamePathMapper.DEFAULT).getNamePathMapper());
+ assertSame(NamePathMapper.DEFAULT, createACL(getTestPath(), List.of(), NamePathMapper.DEFAULT).getNamePathMapper());
}
@Test
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionsTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionsTest.java
index 063c78f9d9..b515b90de4 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionsTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionsTest.java
@@ -24,7 +24,6 @@ import java.util.Set;
import javax.jcr.Session;
import org.apache.jackrabbit.guava.common.base.Splitter;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
@@ -208,7 +207,7 @@ public class PermissionsTest {
@Test
public void testIsAggregate() {
- List<Long> aggregates = ImmutableList.of(Permissions.ALL, Permissions.WRITE, Permissions.READ, Permissions.SET_PROPERTY, Permissions.REMOVE);
+ List<Long> aggregates = List.of(Permissions.ALL, Permissions.WRITE, Permissions.READ, Permissions.SET_PROPERTY, Permissions.REMOVE);
for (long permission : Permissions.PERMISSION_NAMES.keySet()) {
if (aggregates.contains(permission)) {
assertTrue(Permissions.getString(permission), Permissions.isAggregate(permission));
@@ -245,7 +244,7 @@ public class PermissionsTest {
assertFalse(Iterables.contains(aggregates, Permissions.ALL));
Set<Long> expected = new HashSet<>(Permissions.PERMISSION_NAMES.keySet());
- expected.removeAll(ImmutableList.of(Permissions.ALL, Permissions.WRITE, Permissions.READ, Permissions.SET_PROPERTY, Permissions.REMOVE));
+ expected.removeAll(List.of(Permissions.ALL, Permissions.WRITE, Permissions.READ, Permissions.SET_PROPERTY, Permissions.REMOVE));
assertEquals(expected, CollectionUtils.toSet(aggregates));
}
@@ -260,7 +259,7 @@ public class PermissionsTest {
@Test
public void testRespectParentPermissions() {
- List<Long> permissions = ImmutableList.of(
+ List<Long> permissions = List.of(
Permissions.ALL,
Permissions.ADD_NODE,
Permissions.ADD_NODE|Permissions.ADD_PROPERTY,
@@ -278,7 +277,7 @@ public class PermissionsTest {
@Test
public void testNotRespectParentPermissions() {
- List<Long> permissions = ImmutableList.of(
+ List<Long> permissions = List.of(
Permissions.READ,
Permissions.ADD_PROPERTY,
Permissions.REMOVE_PROPERTY,
@@ -357,7 +356,7 @@ public class PermissionsTest {
@Test
public void testGetPermissionsFromInvalidActions() {
TreeLocation tl = TreeLocation.create(existingTree);
- List<String> l = ImmutableList.of(
+ List<String> l = List.of(
Session.ACTION_READ + ",invalid", "invalid", "invalid," + Session.ACTION_REMOVE
);
@@ -555,7 +554,7 @@ public class PermissionsTest {
@Test
public void testGetPermissionsForRegularPaths() {
- for (String path : ImmutableList.of("/", "/a/b/c", "/myfile/jcr:content")) {
+ for (String path : List.of("/", "/a/b/c", "/myfile/jcr:content")) {
for (long defaultPermission : Permissions.PERMISSION_NAMES.keySet()) {
assertEquals(defaultPermission, Permissions.getPermission(path, defaultPermission));
}
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositePatternTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositePatternTest.java
index 2a808817a4..86a54e9913 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositePatternTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositePatternTest.java
@@ -17,7 +17,7 @@
package org.apache.jackrabbit.oak.spi.security.authorization.restriction;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
@@ -32,24 +32,24 @@ import static org.junit.Assert.assertTrue;
public class CompositePatternTest {
- private final RestrictionPattern alwaysMatching = CompositePattern.create(ImmutableList.of(TestRestrictionPatter.INSTANCE_TRUE, TestRestrictionPatter.INSTANCE_TRUE));
- private final RestrictionPattern neverMatching = CompositePattern.create(ImmutableList.of(TestRestrictionPatter.INSTANCE_TRUE, TestRestrictionPatter.INSTANCE_FALSE));
+ private final RestrictionPattern alwaysMatching = CompositePattern.create(List.of(TestRestrictionPatter.INSTANCE_TRUE, TestRestrictionPatter.INSTANCE_TRUE));
+ private final RestrictionPattern neverMatching = CompositePattern.create(List.of(TestRestrictionPatter.INSTANCE_TRUE, TestRestrictionPatter.INSTANCE_FALSE));
@Test
public void testCreateFromEmptyList() {
- RestrictionPattern rp = CompositePattern.create(ImmutableList.of());
+ RestrictionPattern rp = CompositePattern.create(List.of());
assertSame(RestrictionPattern.EMPTY, rp);
}
@Test
public void testCreateFromSingletonList() {
- RestrictionPattern rp = CompositePattern.create(ImmutableList.of(TestRestrictionPatter.INSTANCE_TRUE));
+ RestrictionPattern rp = CompositePattern.create(List.of(TestRestrictionPatter.INSTANCE_TRUE));
assertSame(TestRestrictionPatter.INSTANCE_TRUE, rp);
}
@Test
public void testCreateFromList() {
- RestrictionPattern rp = CompositePattern.create(ImmutableList.of(TestRestrictionPatter.INSTANCE_TRUE, TestRestrictionPatter.INSTANCE_FALSE));
+ RestrictionPattern rp = CompositePattern.create(List.of(TestRestrictionPatter.INSTANCE_TRUE, TestRestrictionPatter.INSTANCE_FALSE));
assertTrue(rp instanceof CompositePattern);
}
@@ -61,7 +61,7 @@ public class CompositePatternTest {
@Test
public void testMatchesPath() {
- List<String> paths = ImmutableList.of("/", "/a", "/a/b/c", "");
+ List<String> paths = List.of("/", "/a", "/a/b/c", "");
for (String path : paths) {
assertTrue(alwaysMatching.matches(path));
@@ -71,7 +71,7 @@ public class CompositePatternTest {
@Test
public void testMatchesPathIsProperty() {
- List<String> paths = ImmutableList.of("/", "/a", "/a/b/c", "");
+ List<String> paths = List.of("/", "/a", "/a/b/c", "");
for (String path : paths) {
assertTrue(alwaysMatching.matches(path, true));
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositeRestrictionProviderTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositeRestrictionProviderTest.java
index f4c1ad1b62..a7091a01ac 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositeRestrictionProviderTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/CompositeRestrictionProviderTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.restriction;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Root;
@@ -66,9 +65,9 @@ public class CompositeRestrictionProviderTest implements AccessControlConstants
private static final String NAME_BOOLEAN = "boolean";
private static final Restriction GLOB_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty(REP_GLOB, "*"), false);
- private static final Restriction NT_PREFIXES_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty(REP_PREFIXES, ImmutableList.of(), Type.STRINGS), false);
+ private static final Restriction NT_PREFIXES_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty(REP_PREFIXES, List.of(), Type.STRINGS), false);
private static final Restriction MANDATORY_BOOLEAN_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty(NAME_BOOLEAN, true, Type.BOOLEAN), true);
- private static final Restriction LONGS_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty(NAME_LONGS, ImmutableList.of(Long.MAX_VALUE), Type.LONGS), false);
+ private static final Restriction LONGS_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty(NAME_LONGS, List.of(Long.MAX_VALUE), Type.LONGS), false);
private static final Restriction UNKNOWN_RESTRICTION = new RestrictionImpl(PropertyStates.createProperty("unknown", "string"), false);
private final AbstractRestrictionProvider rp1 = spy(createRestrictionProvider(GLOB_RESTRICTION.getDefinition(), NT_PREFIXES_RESTRICTION.getDefinition()));
@@ -300,7 +299,7 @@ public class CompositeRestrictionProviderTest implements AccessControlConstants
@Test(expected = AccessControlException.class)
public void testValidateRestrictionsInvalidDefinition() throws Exception {
- Restriction rWithInvalidDefinition = new RestrictionImpl(PropertyStates.createProperty(REP_GLOB, ImmutableList.of("str", "str2"), Type.STRINGS), false);
+ Restriction rWithInvalidDefinition = new RestrictionImpl(PropertyStates.createProperty(REP_GLOB, List.of("str", "str2"), Type.STRINGS), false);
Tree aceTree = getAceTree(rWithInvalidDefinition, MANDATORY_BOOLEAN_RESTRICTION);
RestrictionProvider rp = createRestrictionProvider(null, rWithInvalidDefinition, GLOB_RESTRICTION.getDefinition());
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java
index bc099e5f0c..cbc4f716bd 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.restriction;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
@@ -112,7 +111,7 @@ public class RestrictionImplTest {
// - different type
rs.add(new RestrictionImpl(PropertyStates.createProperty(name, value, Type.STRING), isMandatory));
// - different multi-value status
- rs.add(new RestrictionImpl(PropertyStates.createProperty(name, ImmutableList.of(value), Type.NAMES), isMandatory));
+ rs.add(new RestrictionImpl(PropertyStates.createProperty(name, List.of(value), Type.NAMES), isMandatory));
// - different name
rs.add(new RestrictionImpl(createProperty("otherName", value, type), isMandatory));
// - different value
@@ -151,7 +150,7 @@ public class RestrictionImplTest {
// - different type
rs.add(new RestrictionImpl(PropertyStates.createProperty(name, value, Type.STRING), isMandatory));
// - different multi-value status
- rs.add(new RestrictionImpl(PropertyStates.createProperty(name, ImmutableList.of(value), Type.NAMES), isMandatory));
+ rs.add(new RestrictionImpl(PropertyStates.createProperty(name, List.of(value), Type.NAMES), isMandatory));
// - different name
rs.add(new RestrictionImpl(createProperty("otherName", value, type), isMandatory));
// - different value
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
index df88787fb7..9fae2b7021 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
@@ -27,7 +27,6 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
@@ -53,7 +52,7 @@ public class CompositePrincipalProviderTest {
private final TestPrincipalProvider pp1 = new TestPrincipalProvider();
private final TestPrincipalProvider pp2 = new TestPrincipalProvider("p1", "p2");
- private final PrincipalProvider cpp = CompositePrincipalProvider.of(ImmutableList.<PrincipalProvider>of(pp1, pp2));
+ private final PrincipalProvider cpp = CompositePrincipalProvider.of(List.<PrincipalProvider>of(pp1, pp2));
private Iterable<Principal> testPrincipals() {
return Iterables.concat(pp1.getTestPrincipals(), pp2.getTestPrincipals());
@@ -65,13 +64,13 @@ public class CompositePrincipalProviderTest {
@Test
public void testOfEmptyList() {
- assertSame(EmptyPrincipalProvider.INSTANCE, CompositePrincipalProvider.of(ImmutableList.<PrincipalProvider>of()));
+ assertSame(EmptyPrincipalProvider.INSTANCE, CompositePrincipalProvider.of(List.<PrincipalProvider>of()));
}
@Test
public void testOfSingletonList() {
PrincipalProvider pp = new TestPrincipalProvider(true);
- assertSame(pp, CompositePrincipalProvider.of(ImmutableList.of(pp)));
+ assertSame(pp, CompositePrincipalProvider.of(List.of(pp)));
}
@Test
@@ -107,7 +106,7 @@ public class CompositePrincipalProviderTest {
ItemBasedPrincipal p = mock(ItemBasedPrincipal.class);
PrincipalProvider pp = when(mock(PrincipalProvider.class).getItemBasedPrincipal(anyString())).thenReturn(p).getMock();
- assertEquals(p, CompositePrincipalProvider.of(ImmutableList.of(pp, pp2)).getItemBasedPrincipal("/any/path"));
+ assertEquals(p, CompositePrincipalProvider.of(List.of(pp, pp2)).getItemBasedPrincipal("/any/path"));
}
@Test
@@ -165,7 +164,7 @@ public class CompositePrincipalProviderTest {
*/
@Test
public void testRangeDefault() {
- List<? extends Principal> pps = ImmutableList.of(new PrincipalImpl("p0"), new PrincipalImpl("p1"),
+ List<? extends Principal> pps = List.of(new PrincipalImpl("p0"), new PrincipalImpl("p1"),
new PrincipalImpl("p2"));
PrincipalProvider pp = new PrincipalProvider() {
@@ -271,7 +270,7 @@ public class CompositePrincipalProviderTest {
// NOTE: CompositePrincipalProvider passes 0 offset to the aggregated provider!
when(pp.findPrincipals("p", false, PrincipalManager.SEARCH_TYPE_ALL, 0, 3)).thenReturn(principals);
- PrincipalProvider cpp = CompositePrincipalProvider.of(ImmutableList.of(pp, EmptyPrincipalProvider.INSTANCE));
+ PrincipalProvider cpp = CompositePrincipalProvider.of(List.of(pp, EmptyPrincipalProvider.INSTANCE));
Iterator<? extends Principal> it = cpp.findPrincipals("p", false, PrincipalManager.SEARCH_TYPE_ALL, 2, 1);
assertTrue(it.hasNext());
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/ImmutablePrivilegeDefinitionTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/ImmutablePrivilegeDefinitionTest.java
index 06c9126bde..dc09be37d4 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/ImmutablePrivilegeDefinitionTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/ImmutablePrivilegeDefinitionTest.java
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.oak.spi.security.privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.junit.Test;
import org.mockito.Mockito;
+import java.util.List;
import java.util.Set;
import static org.junit.Assert.assertEquals;
@@ -29,7 +29,7 @@ import static org.mockito.Mockito.when;
public class ImmutablePrivilegeDefinitionTest {
- private final ImmutablePrivilegeDefinition def = new ImmutablePrivilegeDefinition("name", true, ImmutableList.of("aggrName"));
+ private final ImmutablePrivilegeDefinition def = new ImmutablePrivilegeDefinition("name", true, List.of("aggrName"));
@Test
public void testGetName() {
@@ -72,17 +72,17 @@ public class ImmutablePrivilegeDefinitionTest {
assertNotEquals(def, otherDef);
assertNotEquals(def, null);
- assertNotEquals(def, new ImmutablePrivilegeDefinition("othername", true, ImmutableList.of("aggrName")));
- assertNotEquals(def, new ImmutablePrivilegeDefinition("name", false, ImmutableList.of("aggrName")));
- assertNotEquals(def, new ImmutablePrivilegeDefinition("name", true, ImmutableList.of("anotherName")));
- assertNotEquals(def, new ImmutablePrivilegeDefinition("name", true, ImmutableList.of()));
- assertNotEquals(def, new ImmutablePrivilegeDefinition("otherName", false, ImmutableList.of("aggrName","aggrName2")));
+ assertNotEquals(def, new ImmutablePrivilegeDefinition("othername", true, List.of("aggrName")));
+ assertNotEquals(def, new ImmutablePrivilegeDefinition("name", false, List.of("aggrName")));
+ assertNotEquals(def, new ImmutablePrivilegeDefinition("name", true, List.of("anotherName")));
+ assertNotEquals(def, new ImmutablePrivilegeDefinition("name", true, List.of()));
+ assertNotEquals(def, new ImmutablePrivilegeDefinition("otherName", false, List.of("aggrName","aggrName2")));
}
@Test
public void testToString() {
assertEquals(def.toString(), def.toString());
assertEquals(def.toString(), new ImmutablePrivilegeDefinition(def.getName(), def.isAbstract(), def.getDeclaredAggregateNames()).toString());
- assertEquals(def.toString(), new ImmutablePrivilegeDefinition(def.getName(), def.isAbstract(), ImmutableList.of()).toString());
+ assertEquals(def.toString(), new ImmutablePrivilegeDefinition(def.getName(), def.isAbstract(), List.of()).toString());
}
}
\ No newline at end of file
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProviderTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProviderTest.java
index 048a25e0b7..6c0f8bead4 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProviderTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProviderTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.privilege;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Root;
@@ -34,6 +33,7 @@ import org.mockito.Mockito;
import javax.jcr.security.AccessControlException;
import javax.jcr.security.Privilege;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
import static org.junit.Assert.assertEquals;
@@ -111,7 +111,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsEmptyIterable() {
- assertSame(PrivilegeBits.EMPTY, bitsProvider.getBits(ImmutableList.of()));
+ assertSame(PrivilegeBits.EMPTY, bitsProvider.getBits(List.of()));
}
@Test
@@ -124,7 +124,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsBuiltInSingleton() {
- PrivilegeBits bits = bitsProvider.getBits(ImmutableList.of(JCR_LOCK_MANAGEMENT));
+ PrivilegeBits bits = bitsProvider.getBits(List.of(JCR_LOCK_MANAGEMENT));
assertFalse(bits.isEmpty());
assertEquals(PrivilegeBits.BUILT_IN.get(JCR_LOCK_MANAGEMENT), bits);
@@ -141,7 +141,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsBuiltInIterable() {
- PrivilegeBits bits = bitsProvider.getBits(ImmutableList.of(JCR_ADD_CHILD_NODES, JCR_REMOVE_CHILD_NODES));
+ PrivilegeBits bits = bitsProvider.getBits(List.of(JCR_ADD_CHILD_NODES, JCR_REMOVE_CHILD_NODES));
assertFalse(bits.isEmpty());
PrivilegeBits mod = PrivilegeBits.getInstance(bitsProvider.getBits(JCR_ADD_CHILD_NODES)).add(bitsProvider.getBits(JCR_REMOVE_CHILD_NODES));
@@ -167,7 +167,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsTwiceSingleBuiltIn() {
- Iterable<String> names = ImmutableList.of(JCR_ADD_CHILD_NODES);
+ Iterable<String> names = List.of(JCR_ADD_CHILD_NODES);
PrivilegeBits bits1 = bitsProvider.getBits(names);
PrivilegeBits bits2 = bitsProvider.getBits(names);
@@ -180,7 +180,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsTwiceMultipleBuiltIn() {
- Iterable<String> names = ImmutableList.of(JCR_ADD_CHILD_NODES, JCR_REMOVE_CHILD_NODES);
+ Iterable<String> names = List.of(JCR_ADD_CHILD_NODES, JCR_REMOVE_CHILD_NODES);
PrivilegeBits bits1 = bitsProvider.getBits(names);
PrivilegeBits bits2 = bitsProvider.getBits(names);
@@ -193,7 +193,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsTwiceKnown() {
- Iterable<String> names = ImmutableList.of(KNOWN_PRIV_NAME);
+ Iterable<String> names = List.of(KNOWN_PRIV_NAME);
PrivilegeBits bits1 = bitsProvider.getBits(names);
PrivilegeBits bits2 = bitsProvider.getBits(names);
@@ -206,7 +206,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsTwiceBuitInKnown() {
- Iterable<String> names = ImmutableList.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
+ Iterable<String> names = List.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
PrivilegeBits bits1 = bitsProvider.getBits(names);
PrivilegeBits bits2 = bitsProvider.getBits(names);
@@ -219,7 +219,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsTwiceKnownUnknown() {
- Iterable<String> names = ImmutableList.of(KNOWN_PRIV_NAME, "unknown");
+ Iterable<String> names = List.of(KNOWN_PRIV_NAME, "unknown");
PrivilegeBits bits1 = bitsProvider.getBits(names);
PrivilegeBits bits2 = bitsProvider.getBits(names);
@@ -245,7 +245,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test
public void testGetBitsValidateTwiceBuitInKnown() throws Exception {
- Iterable<String> names = ImmutableList.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
+ Iterable<String> names = List.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
PrivilegeBits bits1 = bitsProvider.getBits(names, true);
PrivilegeBits bits2 = bitsProvider.getBits(names, false);
@@ -258,7 +258,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
@Test(expected = AccessControlException.class)
public void testBitsValidateNonExistingTree() throws Exception {
- Iterable<String> names = ImmutableList.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
+ Iterable<String> names = List.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
when(privTree.exists()).thenReturn(true);
when(privTree.hasChild(KNOWN_PRIV_NAME)).thenReturn(false);
@@ -267,7 +267,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
}
public void testBitsValidateFalseNonExistingTree() throws Exception {
- Iterable<String> names = ImmutableList.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
+ Iterable<String> names = List.of(KNOWN_PRIV_NAME, JCR_ADD_CHILD_NODES);
when(privTree.exists()).thenReturn(true);
when(privTree.hasChild(KNOWN_PRIV_NAME)).thenReturn(false);
@@ -354,7 +354,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
when(anotherPriv.exists()).thenReturn(true);
when(anotherPriv.getName()).thenReturn("name2");
when(anotherPriv.hasProperty(REP_AGGREGATES)).thenReturn(true);
- when(anotherPriv.getProperty(REP_AGGREGATES)).thenReturn(PropertyStates.createProperty(REP_AGGREGATES, ImmutableList.of(KNOWN_PRIV_NAME), Type.NAMES));
+ when(anotherPriv.getProperty(REP_AGGREGATES)).thenReturn(PropertyStates.createProperty(REP_AGGREGATES, List.of(KNOWN_PRIV_NAME), Type.NAMES));
PropertyState bits2 = PropertyStates.createProperty(REP_BITS, 7500L);
when(anotherPriv.getProperty(REP_BITS)).thenReturn(bits2);
@@ -463,7 +463,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants {
when(privTree.getChild(KNOWN_PRIV_NAME)).thenReturn(pTree);
Iterable<String> result = bitsProvider.getAggregatedPrivilegeNames(KNOWN_PRIV_NAME);
- assertTrue(Iterables.elementsEqual(ImmutableList.of(KNOWN_PRIV_NAME), result));
+ assertTrue(Iterables.elementsEqual(List.of(KNOWN_PRIV_NAME), result));
}
@Test
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlActionTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlActionTest.java
index 2bd45f5a43..e66b58abb0 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlActionTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlActionTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.jackrabbit.oak.spi.security.user.action;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+import java.util.List;
+
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -36,6 +37,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Test;
+
import javax.jcr.RepositoryException;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.AccessControlPolicy;
@@ -84,14 +86,13 @@ public class AccessControlActionTest implements UserConstants {
AccessControlManager acMgr = mock(AccessControlManager.class);
when(acMgr.getApplicablePolicies("/none")).thenReturn(AccessControlPolicyIteratorAdapter.EMPTY);
AccessControlPolicy policy = mock(AccessControlPolicy.class);
- when(acMgr.getApplicablePolicies("/nonACL")).thenReturn(new AccessControlPolicyIteratorAdapter(ImmutableList.of(policy)));
+ when(acMgr.getApplicablePolicies("/nonACL")).thenReturn(new AccessControlPolicyIteratorAdapter(List.of(policy)));
JackrabbitAccessControlList acl = mock(JackrabbitAccessControlList.class);
if (addEntrySuccess) {
when(acl.addAccessControlEntry(any(Principal.class), any(Privilege[].class))).thenReturn(true);
}
- when(acMgr.getApplicablePolicies("/acl")).thenReturn(new AccessControlPolicyIteratorAdapter(ImmutableList.of(acl)));
+ when(acMgr.getApplicablePolicies("/acl")).thenReturn(new AccessControlPolicyIteratorAdapter(List.of(acl)));
return acMgr;
-
}
private AccessControlAction createAction(@NotNull String... privNames) {
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/CompositeActionProviderTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/CompositeActionProviderTest.java
index 853fd718d8..8c1898fb36 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/CompositeActionProviderTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/CompositeActionProviderTest.java
@@ -17,7 +17,7 @@
package org.apache.jackrabbit.oak.spi.security.user.action;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
+
import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
@@ -47,7 +47,7 @@ public class CompositeActionProviderTest {
AuthorizableActionProvider aap = new TestAuthorizableActionProvider();
AuthorizableActionProvider aap2 = new TestAuthorizableActionProvider();
- assertEquals(ImmutableList.of(TestAction.INSTANCE, TestAction.INSTANCE), new CompositeActionProvider(aap, aap2).getAuthorizableActions(securityProvider));
+ assertEquals(List.of(TestAction.INSTANCE, TestAction.INSTANCE), new CompositeActionProvider(aap, aap2).getAuthorizableActions(securityProvider));
}
@Test
@@ -55,7 +55,7 @@ public class CompositeActionProviderTest {
AuthorizableActionProvider aap = new TestAuthorizableActionProvider();
AuthorizableActionProvider aap2 = new TestAuthorizableActionProvider();
- assertEquals(ImmutableList.of(TestAction.INSTANCE, TestAction.INSTANCE), new CompositeActionProvider(ImmutableList.of(aap, aap2)).getAuthorizableActions(securityProvider));
+ assertEquals(List.of(TestAction.INSTANCE, TestAction.INSTANCE), new CompositeActionProvider(List.of(aap, aap2)).getAuthorizableActions(securityProvider));
}
@@ -64,7 +64,7 @@ public class CompositeActionProviderTest {
@NotNull
@Override
public List<? extends AuthorizableAction> getAuthorizableActions(@NotNull SecurityProvider securityProvider) {
- return ImmutableList.of(TestAction.INSTANCE);
+ return List.of(TestAction.INSTANCE);
}
}
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java
index ebb3642986..6da7e4125f 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.jackrabbit.util.Text;
@@ -45,7 +44,7 @@ public class PasswordUtilTest {
@Before
public void before() throws Exception {
- plainPasswords = ImmutableList.of(
+ plainPasswords = List.of(
"pw",
"PassWord123",
"_",
@@ -235,7 +234,7 @@ public class PasswordUtilTest {
@Test
public void testIsSameMisplacedAlgorithm() {
- List<String> broken = ImmutableList.of("}{pw", "{pw", "{pw}");
+ List<String> broken = List.of("}{pw", "{pw", "{pw}");
for (String hash : broken) {
assertFalse(PasswordUtil.isSame(hash, "pw"));
}
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtilTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtilTest.java
index 33c0e9b7e4..60b0711ffa 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtilTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtilTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.security.user.util;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.AuthorizableTypeException;
@@ -170,7 +169,7 @@ public class UserUtilTest {
@Test
public void testGetTypeFromTree2() {
- List<String> test = ImmutableList.of(
+ List<String> test = List.of(
UserConstants.NT_REP_AUTHORIZABLE,
JcrConstants.NT_FILE
);
@@ -252,7 +251,7 @@ public class UserUtilTest {
@Test
public void testGetAuthorizableId() {
- List<String> test = ImmutableList.of(UserConstants.NT_REP_GROUP, UserConstants.NT_REP_SYSTEM_USER, UserConstants.NT_REP_USER);
+ List<String> test = List.of(UserConstants.NT_REP_GROUP, UserConstants.NT_REP_SYSTEM_USER, UserConstants.NT_REP_USER);
for (String ntName : test) {
assertEquals("id", UserUtil.getAuthorizableId(createTree(ntName, "id")));
}
@@ -260,7 +259,7 @@ public class UserUtilTest {
@Test
public void testGetAuthorizableIdFallback() {
- List<String> test = ImmutableList.of(UserConstants.NT_REP_GROUP, UserConstants.NT_REP_SYSTEM_USER, UserConstants.NT_REP_USER);
+ List<String> test = List.of(UserConstants.NT_REP_GROUP, UserConstants.NT_REP_SYSTEM_USER, UserConstants.NT_REP_USER);
for (String ntName : test) {
assertEquals("nName", UserUtil.getAuthorizableId(createTree(ntName, null, "nName")));
}
@@ -268,7 +267,7 @@ public class UserUtilTest {
@Test
public void testGetAuthorizableIdNoAuthorizableType() {
- List<String> test = ImmutableList.of(UserConstants.NT_REP_AUTHORIZABLE, JcrConstants.NT_UNSTRUCTURED);
+ List<String> test = List.of(UserConstants.NT_REP_AUTHORIZABLE, JcrConstants.NT_UNSTRUCTURED);
for (String ntName : test) {
assertNull(UserUtil.getAuthorizableId(createTree(ntName, "id")));
}
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/NodeInfoTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/NodeInfoTest.java
index f87c326efb..eeb5c3b54c 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/NodeInfoTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/NodeInfoTest.java
@@ -16,15 +16,16 @@
*/
package org.apache.jackrabbit.oak.spi.xml;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.junit.Test;
+import java.util.List;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
public class NodeInfoTest {
- private final NodeInfo nodeInfo = new NodeInfo("name", "primaryType", ImmutableList.of("mixin1", "mixin2"), "uuid");
+ private final NodeInfo nodeInfo = new NodeInfo("name", "primaryType", List.of("mixin1", "mixin2"), "uuid");
@Test
public void testGetName() {
@@ -38,7 +39,7 @@ public class NodeInfoTest {
@Test
public void testGetMixinTypeName() {
- assertEquals(ImmutableList.of("mixin1", "mixin2"), nodeInfo.getMixinTypeNames());
+ assertEquals(List.of("mixin1", "mixin2"), nodeInfo.getMixinTypeNames());
}
@Test
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/PropInfoTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/PropInfoTest.java
index f9b15ad8a8..1e97ff5b5d 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/PropInfoTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/PropInfoTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.xml;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
@@ -76,14 +75,14 @@ public class PropInfoTest {
@Test(expected = DisposeException.class)
public void testDisposeMultipleThrowing() throws Exception {
- PropInfo propInfo = new PropInfo("string", PropertyType.STRING, ImmutableList.of(mockTextValue("value", PropertyType.STRING, true)));
+ PropInfo propInfo = new PropInfo("string", PropertyType.STRING, List.of(mockTextValue("value", PropertyType.STRING, true)));
propInfo.dispose();
}
@Test
public void testDisposeMultiple() throws Exception {
TextValue tv = mockTextValue("value", PropertyType.STRING, false);
- PropInfo propInfo = new PropInfo("string", PropertyType.STRING, ImmutableList.of(tv));
+ PropInfo propInfo = new PropInfo("string", PropertyType.STRING, List.of(tv));
propInfo.dispose();
verify(tv, times(1)).dispose();
}
@@ -121,10 +120,10 @@ public class PropInfoTest {
@Test
public void testIsUnknownMultiple() throws Exception {
- PropInfo propInfo = new PropInfo("boolean", PropertyType.BOOLEAN, ImmutableList.of(mockTextValue("false", PropertyType.BOOLEAN)), PropInfo.MultipleStatus.UNKNOWN);
+ PropInfo propInfo = new PropInfo("boolean", PropertyType.BOOLEAN, List.of(mockTextValue("false", PropertyType.BOOLEAN)), PropInfo.MultipleStatus.UNKNOWN);
assertTrue(propInfo.isUnknownMultiple());
- propInfo = new PropInfo("boolean", PropertyType.BOOLEAN, ImmutableList.of(mockTextValue("false", PropertyType.BOOLEAN)), PropInfo.MultipleStatus.MULTIPLE);
+ propInfo = new PropInfo("boolean", PropertyType.BOOLEAN, List.of(mockTextValue("false", PropertyType.BOOLEAN)), PropInfo.MultipleStatus.MULTIPLE);
assertFalse(propInfo.isUnknownMultiple());
}
@@ -136,25 +135,25 @@ public class PropInfoTest {
@Test
public void testIsUnknownMultipleSingleList() throws Exception {
- PropInfo propInfo = new PropInfo("long", PropertyType.LONG, ImmutableList.of(mockTextValue("24", PropertyType.LONG)));
+ PropInfo propInfo = new PropInfo("long", PropertyType.LONG, List.of(mockTextValue("24", PropertyType.LONG)));
assertTrue(propInfo.isUnknownMultiple());
}
@Test
public void testIsUnknownMultipleSingleList2() throws Exception {
- PropInfo propInfo = new PropInfo("long", PropertyType.LONG, ImmutableList.of(mockTextValue("24", PropertyType.LONG)), PropInfo.MultipleStatus.MULTIPLE);
+ PropInfo propInfo = new PropInfo("long", PropertyType.LONG, List.of(mockTextValue("24", PropertyType.LONG)), PropInfo.MultipleStatus.MULTIPLE);
assertFalse(propInfo.isUnknownMultiple());
}
@Test
public void testIsUnknownMultipleEmpty() {
- PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, ImmutableList.of());
+ PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, List.of());
assertFalse(propInfo.isUnknownMultiple());
}
@Test
public void testIsUnknownMultipleMultiple() throws Exception {
- PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, ImmutableList.of(mockTextValue("24", PropertyType.LONG), mockTextValue("44", PropertyType.LONG)));
+ PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, List.of(mockTextValue("24", PropertyType.LONG), mockTextValue("44", PropertyType.LONG)));
assertFalse(propInfo.isUnknownMultiple());
}
@@ -169,14 +168,14 @@ public class PropInfoTest {
@Test
public void testGetTextValueSingleList() throws Exception {
TextValue tv = mockTextValue("value", PropertyType.STRING);
- PropInfo propInfo = new PropInfo("string", PropertyType.STRING, ImmutableList.of(tv));
+ PropInfo propInfo = new PropInfo("string", PropertyType.STRING, List.of(tv));
assertEquals(tv, propInfo.getTextValue());
}
@Test(expected = RepositoryException.class)
public void testGetTextValueMultiple() throws Exception {
- List<TextValue> tvs = ImmutableList.of(mockTextValue("24", PropertyType.LONG), mockTextValue("35", PropertyType.LONG));
+ List<TextValue> tvs = List.of(mockTextValue("24", PropertyType.LONG), mockTextValue("35", PropertyType.LONG));
PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, tvs);
propInfo.getTextValue();
@@ -187,12 +186,12 @@ public class PropInfoTest {
TextValue tv = mockTextValue("value", PropertyType.STRING);
PropInfo propInfo = new PropInfo("string", PropertyType.STRING, tv);
- assertEquals(ImmutableList.of(tv), propInfo.getTextValues());
+ assertEquals(List.of(tv), propInfo.getTextValues());
}
@Test
public void testGetTextValuesMultiple() throws Exception {
- List<TextValue> tvs = ImmutableList.of(mockTextValue("24", PropertyType.LONG));
+ List<TextValue> tvs = List.of(mockTextValue("24", PropertyType.LONG));
PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, tvs);
assertEquals(tvs, propInfo.getTextValues());
@@ -209,14 +208,14 @@ public class PropInfoTest {
@Test
public void testGetValueSingleList() throws Exception {
TextValue tv = mockTextValue("value", PropertyType.STRING);
- PropInfo propInfo = new PropInfo("string", PropertyType.STRING, ImmutableList.of(tv));
+ PropInfo propInfo = new PropInfo("string", PropertyType.STRING, List.of(tv));
assertEquals(tv.getValue(PropertyType.STRING), propInfo.getValue(PropertyType.STRING));
}
@Test(expected = RepositoryException.class)
public void testGetValueMultiple() throws Exception {
- List<TextValue> tvs = ImmutableList.of(mockTextValue("24", PropertyType.LONG), mockTextValue("35", PropertyType.LONG));
+ List<TextValue> tvs = List.of(mockTextValue("24", PropertyType.LONG), mockTextValue("35", PropertyType.LONG));
PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, tvs);
propInfo.getValue(PropertyType.LONG);
@@ -227,19 +226,19 @@ public class PropInfoTest {
TextValue tv = mockTextValue("value", PropertyType.STRING);
PropInfo propInfo = new PropInfo("string", PropertyType.STRING, tv);
- assertEquals(ImmutableList.of(tv.getValue(PropertyType.STRING)), propInfo.getValues(PropertyType.STRING));
+ assertEquals(List.of(tv.getValue(PropertyType.STRING)), propInfo.getValues(PropertyType.STRING));
}
@Test
public void testGetValuesEmpty() throws Exception {
- PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, ImmutableList.of());
+ PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, List.of());
assertTrue(propInfo.getValues(PropertyType.LONG).isEmpty());
}
@Test
public void testGetValuesMultiple() throws Exception {
- List<TextValue> tvs = ImmutableList.of(mockTextValue("24", PropertyType.LONG));
+ List<TextValue> tvs = List.of(mockTextValue("24", PropertyType.LONG));
PropInfo propInfo = new PropInfo("longs", PropertyType.LONG, tvs);
assertEquals(Lists.transform(tvs, input -> {
@@ -263,7 +262,7 @@ public class PropInfoTest {
@Test
public void testAsPropertyStateEmptyList() throws Exception {
- PropInfo propInfo = new PropInfo("string", PropertyType.STRING, ImmutableList.of());
+ PropInfo propInfo = new PropInfo("string", PropertyType.STRING, List.of());
PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true));
assertTrue(ps.isArray());
@@ -272,7 +271,7 @@ public class PropInfoTest {
@Test
public void testAsPropertyStateSingleList() throws Exception {
- PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, ImmutableList.of(mockTextValue("a", PropertyType.STRING)), PropInfo.MultipleStatus.MULTIPLE);
+ PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, List.of(mockTextValue("a", PropertyType.STRING)), PropInfo.MultipleStatus.MULTIPLE);
PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true));
assertTrue(ps.isArray());
@@ -281,7 +280,7 @@ public class PropInfoTest {
@Test
public void testAsPropertyStateMultiples() throws Exception {
- PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, ImmutableList.of(mockTextValue("a", PropertyType.STRING), mockTextValue("b", PropertyType.STRING)));
+ PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, List.of(mockTextValue("a", PropertyType.STRING), mockTextValue("b", PropertyType.STRING)));
PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true));
assertTrue(ps.isArray());
diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTrackerTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTrackerTest.java
index fa0b1ace5c..f3042da9da 100644
--- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTrackerTest.java
+++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTrackerTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.spi.xml;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.junit.Test;
@@ -53,7 +52,7 @@ public class ReferenceChangeTrackerTest {
assertTrue(Iterators.elementsEqual(List.of("ref", "ref2").iterator(), rct.getProcessedReferences()));
- rct.removeReferences(ImmutableList.of("ref"));
+ rct.removeReferences(List.of("ref"));
assertTrue(Iterators.elementsEqual(List.of("ref2").iterator(), rct.getProcessedReferences()));
}
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java
index dc2fa92311..b214bac8e8 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java
@@ -43,8 +43,6 @@ import java.util.concurrent.TimeUnit;
import ch.qos.logback.classic.Level;
import org.apache.jackrabbit.guava.common.base.Stopwatch;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.guava.common.collect.Sets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
@@ -345,7 +343,7 @@ public class SegmentDataStoreBlobGCIT {
Random rand = new Random(87);
List<String> existing = new ArrayList<>(state.blobsPresent);
- long count = blobStore.countDeleteChunks(ImmutableList.of(existing.get(rand.nextInt(existing.size()))), 0);
+ long count = blobStore.countDeleteChunks(List.of(existing.get(rand.nextInt(existing.size()))), 0);
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(86400, executor);
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java
index 2ea0bc251c..d9789d14d0 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java
@@ -46,7 +46,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.memory.ArrayBasedBlob;
@@ -229,7 +228,7 @@ public class SegmentParserTest {
builder.setChildNode("n");
builder.setProperty("p", 1);
builder.setProperty("jcr:primaryType", "type", NAME);
- builder.setProperty("jcr:mixinTypes", ImmutableList.of("type1", "type2"), NAMES);
+ builder.setProperty("jcr:mixinTypes", List.of("type1", "type2"), NAMES);
SegmentNodeState node = new SegmentNodeState(store.getReader(), writer, store.getBlobStore(), writer.writeNode(builder.getNodeState()));
NodeInfo nodeInfo = new TestParser(store.getReader(), "template") {
@Override
@@ -320,7 +319,7 @@ public class SegmentParserTest {
@Test
public void multiValueProperty() throws IOException {
NodeBuilder builder = EMPTY_NODE.builder();
- builder.setProperty("p", ImmutableList.of(1L, 2L, 3L, 4L), LONGS);
+ builder.setProperty("p", List.of(1L, 2L, 3L, 4L), LONGS);
SegmentNodeState node = new SegmentNodeState(store.getReader(), writer, store.getBlobStore(), writer.writeNode(builder.getNodeState()));
NodeInfo nodeInfo = new TestParser(store.getReader(), "multiValueProperty") {
@Override
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/spi/monitor/CompositeIOMonitorTest.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/spi/monitor/CompositeIOMonitorTest.java
index eaa91f98c8..7d8100061e 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/spi/monitor/CompositeIOMonitorTest.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/spi/monitor/CompositeIOMonitorTest.java
@@ -15,14 +15,13 @@
* limitations under the License.
*
*/
-
package org.apache.jackrabbit.oak.segment.spi.monitor;
import static org.junit.Assert.assertEquals;
import java.io.File;
+import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.whiteboard.Registration;
import org.junit.Test;
@@ -31,8 +30,8 @@ public class CompositeIOMonitorTest {
@Test
public void testComposition() {
- ImmutableList<IOMonitorAssertion> ioMonitors =
- ImmutableList.of(new IOMonitorAssertion(), new IOMonitorAssertion());
+ List<IOMonitorAssertion> ioMonitors =
+ List.of(new IOMonitorAssertion(), new IOMonitorAssertion());
IOMonitor ioMonitor = new CompositeIOMonitor(ioMonitors);
ioMonitor.beforeSegmentRead(FILE, 0, 0, 0);
@@ -50,8 +49,8 @@ public class CompositeIOMonitorTest {
@Test
public void testUnregisterComposition() {
- ImmutableList<IOMonitorAssertion> ioMonitors =
- ImmutableList.of(new IOMonitorAssertion(), new IOMonitorAssertion());
+ List<IOMonitorAssertion> ioMonitors =
+ List.of(new IOMonitorAssertion(), new IOMonitorAssertion());
CompositeIOMonitor ioMonitor = new CompositeIOMonitor();
ioMonitor.registerIOMonitor(ioMonitors.get(0));
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/BreadthFirstTraceTest.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/BreadthFirstTraceTest.java
index b64deaf958..e46f023509 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/BreadthFirstTraceTest.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/BreadthFirstTraceTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.jetbrains.annotations.NotNull;
@@ -46,7 +45,7 @@ public class BreadthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new BreadthFirstTrace(4, "/", trace::add).run(createTree(0));
assertEquals(1, trace.size());
- assertEquals(ImmutableList.of("0", "1"), trace.get(0));
+ assertEquals(List.of("0", "1"), trace.get(0));
}
@Test
@@ -54,8 +53,8 @@ public class BreadthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new BreadthFirstTrace(4, "/", trace::add).run(createTree(1));
assertEquals(2, trace.size());
- assertEquals(ImmutableList.of("0", "1"), trace.get(0));
- assertEquals(ImmutableList.of("1", "2"), trace.get(1));
+ assertEquals(List.of("0", "1"), trace.get(0));
+ assertEquals(List.of("1", "2"), trace.get(1));
}
@Test
@@ -63,9 +62,9 @@ public class BreadthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new BreadthFirstTrace(4, "/", trace::add).run(createTree(2));
assertEquals(3, trace.size());
- assertEquals(ImmutableList.of("0", "1"), trace.get(0));
- assertEquals(ImmutableList.of("1", "2"), trace.get(1));
- assertEquals(ImmutableList.of("2", "3"), trace.get(2));
+ assertEquals(List.of("0", "1"), trace.get(0));
+ assertEquals(List.of("1", "2"), trace.get(1));
+ assertEquals(List.of("2", "3"), trace.get(2));
}
@Test
@@ -73,9 +72,9 @@ public class BreadthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new BreadthFirstTrace(2, "/", trace::add).run(createTree(3));
assertEquals(3, trace.size());
- assertEquals(ImmutableList.of("0", "1"), trace.get(0));
- assertEquals(ImmutableList.of("1", "2"), trace.get(1));
- assertEquals(ImmutableList.of("2", "3"), trace.get(2));
+ assertEquals(List.of("0", "1"), trace.get(0));
+ assertEquals(List.of("1", "2"), trace.get(1));
+ assertEquals(List.of("2", "3"), trace.get(2));
}
}
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/DepthFirstTraceTest.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/DepthFirstTraceTest.java
index 5f3ef1902a..079b4d5413 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/DepthFirstTraceTest.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/DepthFirstTraceTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.jetbrains.annotations.NotNull;
@@ -46,7 +45,7 @@ public class DepthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new DepthFirstTrace(4, "/", trace::add).run(createTree(0));
assertEquals(1, trace.size());
- assertEquals(ImmutableList.of("0", "1", "/"), trace.get(0));
+ assertEquals(List.of("0", "1", "/"), trace.get(0));
}
@Test
@@ -54,8 +53,8 @@ public class DepthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new DepthFirstTrace(4, "/", trace::add).run(createTree(1));
assertEquals(2, trace.size());
- assertEquals(ImmutableList.of("0", "1", "/"), trace.get(0));
- assertEquals(ImmutableList.of("1", "2", "/node-0"), trace.get(1));
+ assertEquals(List.of("0", "1", "/"), trace.get(0));
+ assertEquals(List.of("1", "2", "/node-0"), trace.get(1));
}
@Test
@@ -63,9 +62,9 @@ public class DepthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new DepthFirstTrace(4, "/", trace::add).run(createTree(2));
assertEquals(3, trace.size());
- assertEquals(ImmutableList.of("0", "1", "/"), trace.get(0));
- assertEquals(ImmutableList.of("1", "2", "/node-0"), trace.get(1));
- assertEquals(ImmutableList.of("2", "3", "/node-0/node-1"), trace.get(2));
+ assertEquals(List.of("0", "1", "/"), trace.get(0));
+ assertEquals(List.of("1", "2", "/node-0"), trace.get(1));
+ assertEquals(List.of("2", "3", "/node-0/node-1"), trace.get(2));
}
@Test
@@ -73,9 +72,9 @@ public class DepthFirstTraceTest {
List<List<String>> trace = new ArrayList<>();
new DepthFirstTrace(2, "/", trace::add).run(createTree(3));
assertEquals(3, trace.size());
- assertEquals(ImmutableList.of("0", "1", "/"), trace.get(0));
- assertEquals(ImmutableList.of("1", "2", "/node-0"), trace.get(1));
- assertEquals(ImmutableList.of("2", "3", "/node-0/node-1"), trace.get(2));
+ assertEquals(List.of("0", "1", "/"), trace.get(0));
+ assertEquals(List.of("1", "2", "/node-0"), trace.get(1));
+ assertEquals(List.of("2", "3", "/node-0/node-1"), trace.get(2));
}
}
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/IOTracerTest.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/IOTracerTest.java
index c088d724e6..e5b05ec0ab 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/IOTracerTest.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/IOTracerTest.java
@@ -39,7 +39,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.segment.SegmentNodeBuilder;
import org.apache.jackrabbit.oak.segment.SegmentNodeState;
import org.apache.jackrabbit.oak.segment.file.FileStore;
@@ -176,7 +175,7 @@ public class IOTracerTest extends IOMonitorAdapter {
Function<IOMonitor, FileStore> factory = this::createFileStore;
IOTracer ioTracer = newIOTracer(factory, out, RandomAccessTrace.CONTEXT_SPEC);
- ImmutableList<String> paths = ImmutableList.of("/1a", "/1b", "/foo");
+ List<String> paths = List.of("/1a", "/1b", "/foo");
ioTracer.collectTrace(
new RandomAccessTrace(paths, 0, 10, ioTracer::setContext));
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/RandomTraceTest.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/RandomTraceTest.java
index e2e6b04ed6..170c78c7a6 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/RandomTraceTest.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/iotrace/RandomTraceTest.java
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.jetbrains.annotations.NotNull;
@@ -61,16 +60,16 @@ public class RandomTraceTest {
@Test
public void testTraverseNonExistingPath() {
List<List<String>> trace = new ArrayList<>();
- new RandomAccessTrace(ImmutableList.of("/not/here"), 0, 1, trace::add)
+ new RandomAccessTrace(List.of("/not/here"), 0, 1, trace::add)
.run(createTree(emptyList()));
assertEquals(1, trace.size());
- assertEquals(ImmutableList.of("/not/here"), trace.get(0));
+ assertEquals(List.of("/not/here"), trace.get(0));
}
@Test
public void testTraverse() {
List<List<String>> trace = new ArrayList<>();
- ImmutableList<String> paths = ImmutableList.of("/a/b/c", "/d/e/f");
+ List<String> paths = List.of("/a/b/c", "/d/e/f");
new RandomAccessTrace(paths, 0, 2, trace::add)
.run(createTree(paths));
assertEquals(2, trace.size());
diff --git a/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexIT.java b/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexIT.java
index a1a57ba78a..442093b54c 100644
--- a/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexIT.java
+++ b/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexIT.java
@@ -20,8 +20,8 @@ import javax.jcr.query.Query;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.ContentRepository;
@@ -322,7 +322,7 @@ public class SolrIndexIT extends AbstractQueryTest {
Tree one = t.addChild("one");
one.setProperty("t", "美女衬衫");
root.commit();
- assertQuery("//*[jcr:contains(., '美女')]", "xpath", ImmutableList.of(one.getPath()));
+ assertQuery("//*[jcr:contains(., '美女')]", "xpath", List.of(one.getPath()));
}
@Test
@@ -364,13 +364,13 @@ public class SolrIndexIT extends AbstractQueryTest {
stmt.append("/jcr:root//*[jcr:contains(., '").append(h);
stmt.append("')]");
assertQuery(stmt.toString(), "xpath",
- ImmutableList.of("/test/a", "/test/b"));
+ List.of("/test/a", "/test/b"));
// query 'world'
stmt = new StringBuffer();
stmt.append("/jcr:root//*[jcr:contains(., '").append(w);
stmt.append("')]");
- assertQuery(stmt.toString(), "xpath", ImmutableList.of("/test/a"));
+ assertQuery(stmt.toString(), "xpath", List.of("/test/a"));
}
@@ -384,9 +384,9 @@ public class SolrIndexIT extends AbstractQueryTest {
root.commit();
assertQuery("/jcr:root//*[jcr:contains(., 'hello-wor*')]", "xpath",
- ImmutableList.of("/test/a", "/test/b"));
+ List.of("/test/a", "/test/b"));
assertQuery("/jcr:root//*[jcr:contains(., '*hello-wor*')]", "xpath",
- ImmutableList.of("/test/a", "/test/b"));
+ List.of("/test/a", "/test/b"));
}
@@ -398,7 +398,7 @@ public class SolrIndexIT extends AbstractQueryTest {
assertQuery(
"/jcr:root//*[jcr:contains(@dc:format, 'type:appli*')]",
- "xpath", ImmutableList.of("/test/a"));
+ "xpath", List.of("/test/a"));
}
@@ -411,19 +411,19 @@ public class SolrIndexIT extends AbstractQueryTest {
assertQuery(
"/jcr:root//*[jcr:contains(., 'lazy AND brown')]",
- "xpath", ImmutableList.of("/test/a"));
+ "xpath", List.of("/test/a"));
assertQuery(
"/jcr:root//*[jcr:contains(., 'lazy OR eat')]",
- "xpath", ImmutableList.of("/test/a", "/test/b"));
+ "xpath", List.of("/test/a", "/test/b"));
assertQuery(
"/jcr:root//*[jcr:contains(., 'lazy AND bones')]",
- "xpath", ImmutableList.of("/test/b"));
+ "xpath", List.of("/test/b"));
assertQuery(
"/jcr:root//*[jcr:contains(., 'lazy OR dog')]",
- "xpath", ImmutableList.of("/test/a", "/test/b"));
+ "xpath", List.of("/test/a", "/test/b"));
}
@Test
@@ -433,7 +433,7 @@ public class SolrIndexIT extends AbstractQueryTest {
test.addChild("a").setProperty("name", "/parent/child/node");
root.commit();
- assertQuery("//*[jcr:contains(., '/parent/child')]", "xpath", ImmutableList.of("/test/a"));
+ assertQuery("//*[jcr:contains(., '/parent/child')]", "xpath", List.of("/test/a"));
}
@@ -445,7 +445,7 @@ public class SolrIndexIT extends AbstractQueryTest {
a.setProperty("name", "/segment1/segment2/segment3");
root.commit();
- assertQuery("//*[jcr:contains(., '/segment1/segment2')]", "xpath", ImmutableList.of("/test/a"));
+ assertQuery("//*[jcr:contains(., '/segment1/segment2')]", "xpath", List.of("/test/a"));
}
@@ -470,7 +470,7 @@ public class SolrIndexIT extends AbstractQueryTest {
root.commit();
assertQuery("//*[jcr:contains(., 'media') and (@p = 'dam/smartcollection' or @p = 'dam/collection') ]", "xpath",
- ImmutableList.of(one.getPath(), two.getPath()));
+ List.of(one.getPath(), two.getPath()));
}
@Test
diff --git a/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreServiceTest.java b/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreServiceTest.java
index d52f8c07e5..aab0f42e48 100644
--- a/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreServiceTest.java
+++ b/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreServiceTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.composite;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import java.util.List;
import java.util.Map;
@@ -72,8 +71,8 @@ public class CompositeNodeStoreServiceTest {
nodeStoreLibs.merge(libsRoot, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// Define read-only mounts
- registerActivateMountInfoConfig("libs", ImmutableList.of("/libs"));
- registerActivateMountInfoConfig("apps", ImmutableList.of("/apps"));
+ registerActivateMountInfoConfig("libs", List.of("/libs"));
+ registerActivateMountInfoConfig("apps", List.of("/apps"));
registerMountInfoProviderService("libs", "apps");
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceIteratorTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceIteratorTest.java
index 55731e41ab..3d16e380f6 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceIteratorTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceIteratorTest.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.document;
import java.util.ArrayList;
@@ -24,10 +23,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import com.mongodb.ReadPreference;
import org.apache.jackrabbit.oak.api.Blob;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob;
import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.VersionGCStats;
import org.apache.jackrabbit.oak.plugins.document.mongo.MongoTestUtils;
@@ -133,7 +132,7 @@ public class BlobReferenceIteratorTest {
store.merge(b1, EmptyHook.INSTANCE, CommitInfo.EMPTY);
}
- List<ReferencedBlob> collectedBlobs = ImmutableList.copyOf(store.getReferencedBlobsIterator());
+ List<ReferencedBlob> collectedBlobs = CollectionUtils.toList(store.getReferencedBlobsIterator());
assertEquals(blobs.size(), collectedBlobs.size());
assertEquals(new HashSet<>(blobs), new HashSet<>(collectedBlobs));
}
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
index 7dafb539bb..9a95ae5541 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.document;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static java.util.Collections.emptyList;
import static java.util.Collections.synchronizedList;
import static java.util.concurrent.TimeUnit.SECONDS;
@@ -3920,28 +3919,28 @@ public class DocumentNodeStoreTest {
final long UL = Long.MAX_VALUE; // unknown
// childNodeCount = none
getChildNodeCountTest(0,
- of(0L, 1L),
- of(0L, 0L)
+ List.of(0L, 1L),
+ List.of(0L, 0L)
);
// childNodeCount = less than initial fetch size 42
getChildNodeCountTest(42,
- of( 0L, 1L, 41L, 42L, 43L, 100L),
- of(42L, 42L, 42L, 42L, 42L, 42L)
+ List.of( 0L, 1L, 41L, 42L, 43L, 100L),
+ List.of(42L, 42L, 42L, 42L, 42L, 42L)
);
// childNodeCount = initial fetch size (100)
getChildNodeCountTest(100,
- of( 0L, 1L, 99L, 100L, 101L, 200L),
- of(100L, 100L, 100L, 100L, 100L, 100L)
+ List.of( 0L, 1L, 99L, 100L, 101L, 200L),
+ List.of(100L, 100L, 100L, 100L, 100L, 100L)
);
// childNodeCount = initial fetch size + 1 (100 + 1)
getChildNodeCountTest(101,
- of(0L, 1L, 99L, 100L, 101L, 200L),
- of(UL, UL, UL, UL, 101L, 101L)
+ List.of(0L, 1L, 99L, 100L, 101L, 200L),
+ List.of(UL, UL, UL, UL, 101L, 101L)
);
// childNodeCount = first two fetches (100 + 200)
getChildNodeCountTest(300,
- of(0L, 1L, 99L, 100L, 101L, 200L, 299L, 300L, 301L, 400L),
- of(UL, UL, UL, UL, 300L, 300L, 300L, 300L, 300L, 300L)
+ List.of(0L, 1L, 99L, 100L, 101L, 200L, 299L, 300L, 301L, 400L),
+ List.of(UL, UL, UL, UL, 300L, 300L, 300L, 300L, 300L, 300L)
);
}
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
index 8b8e72b5da..9cfe93c690 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
@@ -26,7 +26,6 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -49,7 +48,6 @@ import org.junit.Test;
import org.apache.jackrabbit.guava.common.collect.Iterables;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
import static org.apache.jackrabbit.oak.plugins.document.MongoBlobGCTest.randomStream;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.DOC_SIZE_THRESHOLD;
@@ -353,7 +351,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
}
ns.runBackgroundOperations();
NodeDocument doc = store.find(NODES, Utils.getIdFromPath("/test/foo"));
- List<NodeDocument> prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(1, prevDocs.size());
assertEquals(SplitDocType.DEFAULT_LEAF, prevDocs.get(0).getSplitDocType());
}
@@ -376,7 +374,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
}
ns.runBackgroundOperations();
NodeDocument doc = store.find(NODES, Utils.getIdFromPath("/test/foo"));
- List<NodeDocument> prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(1, prevDocs.size());
assertEquals(SplitDocType.COMMIT_ROOT_ONLY, prevDocs.get(0).getSplitDocType());
}
@@ -398,7 +396,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
}
ns.runBackgroundOperations();
NodeDocument doc = store.find(NODES, Utils.getIdFromPath("/test/foo"));
- List<NodeDocument> prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(1, prevDocs.size());
//Check for hasBinary
@@ -451,7 +449,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
assertNotNull(doc);
assertEquals(2, doc.getPreviousRanges().size());
- List<NodeDocument> prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
//1 intermediate and 11 previous doc
assertEquals(1 + 11, prevDocs.size());
assertTrue(prevDocs.stream().anyMatch(input -> input.getSplitDocType() == SplitDocType.INTERMEDIATE));
@@ -916,7 +914,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
NodeDocument foo = store.find(NODES, Utils.getIdFromPath("/foo"));
assertNotNull(foo);
- List<NodeDocument> prevDocs = copyOf(foo.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(foo.getAllPreviousDocs());
// all but most recent value are moved to individual previous docs
assertEquals(9, prevDocs.size());
}
@@ -950,7 +948,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
// now the old binary value must be moved to a previous document
foo = store.find(NODES, Utils.getIdFromPath("/foo"));
assertNotNull(foo);
- List<NodeDocument> prevDocs = copyOf(foo.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(foo.getAllPreviousDocs());
assertEquals(1, prevDocs.size());
}
@@ -973,7 +971,7 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
NodeDocument foo = store.find(NODES, Utils.getIdFromPath("/foo"));
assertNotNull(foo);
- List<NodeDocument> prevDocs = copyOf(foo.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(foo.getAllPreviousDocs());
// must not create split documents for small binaries less 4k
assertEquals(0, prevDocs.size());
}
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreStatsTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreStatsTest.java
index 8a3071fbd4..6a7ad6ce40 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreStatsTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreStatsTest.java
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.jackrabbit.oak.plugins.document;
import java.lang.management.ManagementFactory;
+import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -35,7 +35,6 @@ import org.junit.After;
import org.junit.Test;
import org.slf4j.LoggerFactory;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.oak.plugins.document.Collection.JOURNAL;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
import static org.apache.jackrabbit.oak.plugins.document.DocumentStoreStats.JOURNAL_CREATE;
@@ -116,11 +115,11 @@ public class DocumentStoreStatsTest {
@Test
public void doneCreate_Journal() throws Exception{
- stats.doneCreate(100, Collection.JOURNAL, of("a", "b"), true);
+ stats.doneCreate(100, Collection.JOURNAL, List.of("a", "b"), true);
assertEquals(2, getMeter(DocumentStoreStats.JOURNAL_CREATE).getCount());
assertEquals(100, getTimer(DocumentStoreStats.JOURNAL_CREATE_TIMER).getSnapshot().getMax());
- stats.doneCreate(100, JOURNAL, of("c", "d"), false);
+ stats.doneCreate(100, JOURNAL, List.of("c", "d"), false);
assertEquals(4, getMeter(JOURNAL_CREATE).getCount());
assertEquals(100, getTimer(JOURNAL_CREATE_TIMER).getSnapshot().getMax());
}
@@ -129,24 +128,24 @@ public class DocumentStoreStatsTest {
public void doneCreate_Nodes() {
// empty list of ids
- stats.doneCreate(100, NODES, of(), true);
+ stats.doneCreate(100, NODES, List.of(), true);
assertEquals(0, getMeter(NODES_CREATE).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(0, getTimer(NODES_CREATE_TIMER).getSnapshot().getMax());
- stats.doneCreate(100, NODES, of("a", "b"), true);
+ stats.doneCreate(100, NODES, List.of("a", "b"), true);
assertEquals(2, getMeter(NODES_CREATE).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(50, getTimer(NODES_CREATE_TIMER).getSnapshot().getMax());
// adding an Id with previous doc
- stats.doneCreate(200, NODES, of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"), true);
+ stats.doneCreate(200, NODES, List.of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"), true);
assertEquals(3, getMeter(NODES_CREATE).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(200, getTimer(NODES_CREATE_TIMER).getSnapshot().getMax());
// if insert is not successful
- stats.doneCreate(200, NODES, of("c"), false);
+ stats.doneCreate(200, NODES, List.of("c"), false);
assertEquals(3, getMeter(NODES_CREATE).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(200, getTimer(NODES_CREATE_TIMER).getSnapshot().getMax());
@@ -160,24 +159,24 @@ public class DocumentStoreStatsTest {
public void doneCreateOrUpdate() {
// empty list of ids
- stats.doneCreateOrUpdate(100, NODES, of());
+ stats.doneCreateOrUpdate(100, NODES, List.of());
assertEquals(0, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
- stats.doneCreateOrUpdate(100, NODES, of("a", "b"));
+ stats.doneCreateOrUpdate(100, NODES, List.of("a", "b"));
assertEquals(2, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(50, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
// adding an Id with previous Doc
- stats.doneCreateOrUpdate(200, NODES, of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"));
+ stats.doneCreateOrUpdate(200, NODES, List.of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"));
assertEquals(3, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(200, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
// insert is done for journal collection
- stats.doneCreateOrUpdate(200, JOURNAL, of("c"));
+ stats.doneCreateOrUpdate(200, JOURNAL, List.of("c"));
assertEquals(3, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT).getCount());
assertEquals(200, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
@@ -199,21 +198,21 @@ public class DocumentStoreStatsTest {
public void doneBulkFindAndModify() {
// no node had been updated i.e. empty list of Ids
- stats.doneFindAndModify(100, NODES, of(), true, 0);
+ stats.doneFindAndModify(100, NODES, List.of(), true, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
assertEquals(0, getMeter(NODES_UPDATE).getCount());
assertEquals(0, getTimer(NODES_UPDATE_TIMER).getSnapshot().getMax());
// 2 nodes had been updated
- stats.doneFindAndModify(100, NODES, of("foo", "bar"), true, 0);
+ stats.doneFindAndModify(100, NODES, List.of("foo", "bar"), true, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
assertEquals(2, getMeter(NODES_UPDATE).getCount());
assertEquals(50, getTimer(NODES_UPDATE_TIMER).getSnapshot().getMax());
// fails to update 2 nodes without retrying
- stats.doneFindAndModify(100, NODES, of("foo", "bar"), false, 0);
+ stats.doneFindAndModify(100, NODES, List.of("foo", "bar"), false, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
assertEquals(2, getMeter(NODES_UPDATE).getCount());
@@ -222,7 +221,7 @@ public class DocumentStoreStatsTest {
assertEquals(1, getMeter(NODES_UPDATE_FAILURE).getCount());
// update is done on Journal collection
- stats.doneFindAndModify(100, JOURNAL, of("foo", "bar"), true, 0);
+ stats.doneFindAndModify(100, JOURNAL, List.of("foo", "bar"), true, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_TIMER).getSnapshot().getMax());
assertEquals(2, getMeter(NODES_UPDATE).getCount());
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/FormatVersionTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/FormatVersionTest.java
index dcf2ea492e..e94038e934 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/FormatVersionTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/FormatVersionTest.java
@@ -19,8 +19,6 @@ package org.apache.jackrabbit.oak.plugins.document;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-
import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
import org.junit.Test;
@@ -102,7 +100,7 @@ public class FormatVersionTest {
// must not write dummy version
assertFalse(V0.writeTo(store));
// upgrade
- for (FormatVersion v : ImmutableList.of(V1_0, V1_2, V1_4, V1_6, V1_8)) {
+ for (FormatVersion v : List.of(V1_0, V1_2, V1_4, V1_6, V1_8)) {
assertTrue(v.writeTo(store));
assertSame(v, FormatVersion.versionOf(store));
}
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java
index 274769ecff..b5fbbea014 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java
@@ -36,8 +36,6 @@ import ch.qos.logback.classic.Level;
import org.apache.jackrabbit.guava.common.base.Splitter;
import org.apache.jackrabbit.guava.common.base.Stopwatch;
import org.apache.jackrabbit.guava.common.base.Strings;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.guava.common.collect.Sets;
import org.apache.jackrabbit.guava.common.io.Closeables;
import com.mongodb.BasicDBObject;
@@ -320,8 +318,8 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
GarbageCollectableBlobStore store = (GarbageCollectableBlobStore)
mk.getNodeStore().getBlobStore();
- long count = store.countDeleteChunks(ImmutableList.of(existing.get(rand.nextInt(existing.size()))), 0);
-
+ long count = store.countDeleteChunks(List.of(existing.get(rand.nextInt(existing.size()))), 0);
+
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(86400, executor);
long candidates = gcObj.checkConsistency();
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ThrottlingStatsCollectorImplTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ThrottlingStatsCollectorImplTest.java
index 6bd4c02838..ea7a75b17d 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ThrottlingStatsCollectorImplTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ThrottlingStatsCollectorImplTest.java
@@ -25,9 +25,9 @@ import org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider;
import org.junit.After;
import org.junit.Test;
+import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static java.lang.management.ManagementFactory.getPlatformMBeanServer;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.apache.jackrabbit.oak.plugins.document.Collection.JOURNAL;
@@ -65,16 +65,16 @@ public class ThrottlingStatsCollectorImplTest {
@Test
public void doneCreateJournal() {
- stats.doneCreate(100, JOURNAL, of("a", "b"), true);
+ stats.doneCreate(100, JOURNAL, List.of("a", "b"), true);
assertEquals(2, getMeter(JOURNAL_CREATE_THROTTLING).getCount());
assertEquals(100, getTimer(JOURNAL_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
- stats.doneCreate(200, JOURNAL, of("c", "d"), true);
+ stats.doneCreate(200, JOURNAL, List.of("c", "d"), true);
assertEquals(4, getMeter(JOURNAL_CREATE_THROTTLING).getCount());
assertEquals(200, getTimer(JOURNAL_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
// journal metrics updated even if insert is not successful
- stats.doneCreate(200, JOURNAL, of("e", "f"), false);
+ stats.doneCreate(200, JOURNAL, List.of("e", "f"), false);
assertEquals(6, getMeter(JOURNAL_CREATE_THROTTLING).getCount());
assertEquals(200, getTimer(JOURNAL_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
@@ -88,24 +88,24 @@ public class ThrottlingStatsCollectorImplTest {
public void doneCreateNodes() {
// empty list of ids
- stats.doneCreate(100, NODES, of(), true);
+ stats.doneCreate(100, NODES, List.of(), true);
assertEquals(0, getMeter(NODES_CREATE_THROTTLING).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(0, getTimer(NODES_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
- stats.doneCreate(100, NODES, of("a", "b"), true);
+ stats.doneCreate(100, NODES, List.of("a", "b"), true);
assertEquals(2, getMeter(NODES_CREATE_THROTTLING).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(50, getTimer(NODES_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
// adding an Id with previous Doc
- stats.doneCreate(200, NODES, of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"), true);
+ stats.doneCreate(200, NODES, List.of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"), true);
assertEquals(3, getMeter(NODES_CREATE_THROTTLING).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(200, getTimer(NODES_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
// insert is not successful
- stats.doneCreate(200, NODES, of("c"), false);
+ stats.doneCreate(200, NODES, List.of("c"), false);
assertEquals(3, getMeter(NODES_CREATE_THROTTLING).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(200, getTimer(NODES_CREATE_THROTTLING_TIMER).getSnapshot().getMax());
@@ -119,24 +119,24 @@ public class ThrottlingStatsCollectorImplTest {
public void doneCreateOrUpdate() {
// empty list of ids
- stats.doneCreateOrUpdate(100, NODES, of());
+ stats.doneCreateOrUpdate(100, NODES, List.of());
assertEquals(0, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
- stats.doneCreateOrUpdate(100, NODES, of("a", "b"));
+ stats.doneCreateOrUpdate(100, NODES, List.of("a", "b"));
assertEquals(2, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(0, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(50, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
// adding an Id with previous Doc
- stats.doneCreateOrUpdate(200, NODES, of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"));
+ stats.doneCreateOrUpdate(200, NODES, List.of("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/r182f83543dd-0-0/3"));
assertEquals(3, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(200, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
// insert is done for journal collection
- stats.doneCreateOrUpdate(200, JOURNAL, of("c"));
+ stats.doneCreateOrUpdate(200, JOURNAL, List.of("c"));
assertEquals(3, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(1, getMeter(NODES_CREATE_SPLIT_THROTTLING).getCount());
assertEquals(200, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
@@ -178,7 +178,7 @@ public class ThrottlingStatsCollectorImplTest {
public void doneBulkFindAndModify() {
// no node had been updated i.e. empty list of Ids
- stats.doneFindAndModify(100, NODES, of(), true, 0);
+ stats.doneFindAndModify(100, NODES, List.of(), true, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
assertEquals(0, getMeter(NODES_UPDATE_THROTTLING).getCount());
@@ -186,14 +186,14 @@ public class ThrottlingStatsCollectorImplTest {
assertEquals(0, getMeter(NODES_UPDATE_RETRY_COUNT_THROTTLING).getCount());
// 2 nodes had been updated
- stats.doneFindAndModify(100, NODES, of("foo", "bar"), true, 0);
+ stats.doneFindAndModify(100, NODES, List.of("foo", "bar"), true, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
assertEquals(2, getMeter(NODES_UPDATE_THROTTLING).getCount());
assertEquals(50, getTimer(NODES_UPDATE_THROTTLING_TIMER).getSnapshot().getMax());
// fails to update 2 nodes without retrying
- stats.doneFindAndModify(100, NODES, of("foo", "bar"), false, 0);
+ stats.doneFindAndModify(100, NODES, List.of("foo", "bar"), false, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
assertEquals(2, getMeter(NODES_UPDATE_THROTTLING).getCount());
@@ -202,14 +202,14 @@ public class ThrottlingStatsCollectorImplTest {
assertEquals(1, getMeter(NODES_UPDATE_FAILURE_THROTTLING).getCount());
// entry updated after 3 retries
- stats.doneFindAndModify(100, NODES, of("foo", "bar"), true, 3);
+ stats.doneFindAndModify(100, NODES, List.of("foo", "bar"), true, 3);
assertEquals(4, getMeter(NODES_UPDATE_THROTTLING).getCount());
assertEquals(50, getTimer(NODES_UPDATE_THROTTLING_TIMER).getSnapshot().getMax());
assertEquals(3, getMeter(NODES_UPDATE_RETRY_COUNT_THROTTLING).getCount());
assertEquals(1, getMeter(NODES_UPDATE_FAILURE_THROTTLING).getCount());
// update is done on Journal collection
- stats.doneFindAndModify(100, JOURNAL, of("foo", "bar"), true, 0);
+ stats.doneFindAndModify(100, JOURNAL, List.of("foo", "bar"), true, 0);
assertEquals(0, getMeter(NODES_CREATE_UPSERT_THROTTLING).getCount());
assertEquals(0, getTimer(NODES_CREATE_UPSERT_THROTTLING_TIMER).getSnapshot().getMax());
assertEquals(4, getMeter(NODES_UPDATE_THROTTLING).getCount());
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
index 9fc0a3a8c6..a6f1020b67 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
@@ -103,9 +103,7 @@ import static org.junit.Assume.assumeTrue;
import org.apache.jackrabbit.guava.common.cache.Cache;
import org.apache.jackrabbit.guava.common.collect.AbstractIterator;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.guava.common.collect.Iterators;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.guava.common.collect.Queues;
import com.mongodb.ReadPreference;
@@ -3070,11 +3068,11 @@ public class VersionGarbageCollectorIT {
store1.runBackgroundOperations();
List<NodeDocument> previousDocTestFoo =
- ImmutableList.copyOf(getDoc("/test/" + subNodeName).getAllPreviousDocs());
+ CollectionUtils.toList(getDoc("/test/" + subNodeName).getAllPreviousDocs());
List<NodeDocument> previousDocTestFoo2 =
- ImmutableList.copyOf(getDoc("/test2/" + subNodeName).getAllPreviousDocs());
+ CollectionUtils.toList(getDoc("/test2/" + subNodeName).getAllPreviousDocs());
List<NodeDocument> previousDocRoot =
- ImmutableList.copyOf(getDoc("/").getAllPreviousDocs());
+ CollectionUtils.toList(getDoc("/").getAllPreviousDocs());
assertEquals(1, previousDocTestFoo.size());
assertEquals(1, previousDocTestFoo2.size());
@@ -3096,7 +3094,7 @@ public class VersionGarbageCollectorIT {
//Following would not work for Mongo as the delete happened on the server side
//And entries from cache are not evicted
- //assertTrue(ImmutableList.copyOf(getDoc("/test2/foo").getAllPreviousDocs()).isEmpty());
+ //assertTrue(List.copyOf(getDoc("/test2/foo").getAllPreviousDocs()).isEmpty());
}
/**
@@ -3813,7 +3811,7 @@ public class VersionGarbageCollectorIT {
NodeDocument doc = getDoc("/foo");
assertNotNull(doc);
- List<NodeDocument> prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(1, prevDocs.size());
assertEquals(SplitDocType.DEFAULT_NO_BRANCH, prevDocs.get(0).getSplitDocType());
@@ -3824,7 +3822,7 @@ public class VersionGarbageCollectorIT {
doc = getDoc("/foo");
assertNotNull(doc);
- prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(0, prevDocs.size());
assertEquals(value, store1.getRoot().getChildNode("foo").getString("prop"));
@@ -3851,7 +3849,7 @@ public class VersionGarbageCollectorIT {
// now /foo must have previous docs
NodeDocument doc = getDoc("/foo");
- List<NodeDocument> prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ List<NodeDocument> prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(1, prevDocs.size());
assertEquals(SplitDocType.DEFAULT_NO_BRANCH, prevDocs.get(0).getSplitDocType());
@@ -3877,7 +3875,7 @@ public class VersionGarbageCollectorIT {
doc = getDoc("/foo");
assertNotNull(doc);
- prevDocs = ImmutableList.copyOf(doc.getAllPreviousDocs());
+ prevDocs = CollectionUtils.toList(doc.getAllPreviousDocs());
assertEquals(0, prevDocs.size());
// check value
assertEquals(value, store1.getRoot().getChildNode("foo").getString("prop"));
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
index 06dd7dcec3..9dc5f19cf2 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
@@ -47,9 +47,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
-import org.apache.jackrabbit.guava.common.collect.ImmutableList;
-import org.apache.jackrabbit.guava.common.collect.Lists;
-
/**
* Tests the RDBBlobStore implementation.
*/
@@ -199,7 +196,7 @@ public class RDBBlobStoreTest extends AbstractBlobStoreTest {
RDBBlobStoreFriend.storeBlock(blobStore, digest, 0, data);
// Metadata row should not have been touched
Assert.assertFalse("entry was cleaned although it shouldn't have",
- blobStore.deleteChunks(ImmutableList.of(id), beforeUpdateTs));
+ blobStore.deleteChunks(List.of(id), beforeUpdateTs));
// Actual data row should still be present
Assert.assertNotNull(RDBBlobStoreFriend.readBlockFromBackend(blobStore, digest));
}
@@ -228,7 +225,7 @@ public class RDBBlobStoreTest extends AbstractBlobStoreTest {
byte[] digest2 = getDigest(data2);
RDBBlobStoreFriend.storeBlock(blobStore, digest2, 0, data2);
- Assert.assertEquals("meta entry was not removed", 1, blobStore.countDeleteChunks(ImmutableList.of(id1), now));
+ Assert.assertEquals("meta entry was not removed", 1, blobStore.countDeleteChunks(List.of(id1), now));
Assert.assertFalse("data entry was not removed", RDBBlobStoreFriend.isDataEntryPresent(blobStore, digest1));
}
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java
index a833ad94cb..e1a5678017 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java
@@ -20,7 +20,7 @@
package org.apache.jackrabbit.oak.plugins.document.bundlor;
import java.util.Collections;
-
+import java.util.List;
import org.apache.jackrabbit.guava.common.collect.ArrayListMultimap;
import org.apache.jackrabbit.guava.common.collect.ListMultimap;
@@ -47,7 +47,6 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
import static org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.SYS_PROP_DISABLE_JOURNAL;
import static org.apache.jackrabbit.oak.plugins.document.TestUtils.childBuilder;
import static org.apache.jackrabbit.oak.plugins.document.TestUtils.createChild;
@@ -185,7 +184,7 @@ public class BundledDocumentDifferTest {
@Test
public void jsopDiff() throws Exception{
JsopWriter w = new JsopBuilder();
- differ.diffChildren(of("a", "b"), of("b", "c"), w);
+ differ.diffChildren(List.of("a", "b"), List.of("b", "c"), w);
//removed a
//changed b
@@ -246,7 +245,7 @@ public class BundledDocumentDifferTest {
}
private SecondaryStoreCache configureSecondary(){
- SecondaryStoreBuilder builder = createBuilder(new PathFilter(of("/"), Collections.<String>emptyList()));
+ SecondaryStoreBuilder builder = createBuilder(new PathFilter(List.of("/"), Collections.emptyList()));
builder.metaPropNames(DocumentNodeStore.META_PROP_NAMES);
SecondaryStoreCache cache = builder.buildCache();
SecondaryStoreObserver observer = builder.buildObserver(cache);
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
index 9e0f958c53..63ab8c5e90 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
@@ -26,13 +26,13 @@ import java.util.List;
import java.util.Set;
import org.apache.jackrabbit.guava.common.collect.Iterables;
-import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.document.Collection;
import org.apache.jackrabbit.oak.plugins.document.Document;
import org.apache.jackrabbit.oak.plugins.document.DocumentMKBuilderProvider;
@@ -67,7 +67,6 @@ import org.junit.Test;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
import static org.apache.commons.io.FileUtils.ONE_MB;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
@@ -1047,7 +1046,7 @@ public class DocumentBundlingTest {
}
private static List<String> childNames(NodeState state, String path){
- return copyOf(getNode(state, path).getChildNodeNames());
+ return CollectionUtils.toList(getNode(state, path).getChildNodeNames());
}
static NodeBuilder newNode(String typeName){
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheTest.java
... 408 lines suppressed ...