This is an automated email from the ASF dual-hosted git repository. daim pushed a commit to branch OAK-11449 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit db10f9000b7a0ebb86e1a95dadca2b073bfd0202 Author: Rishabh Kumar <[email protected]> AuthorDate: Sat Feb 1 22:17:54 2025 +0530 OAK-11449 : removed usage of Guava Iterables.concat --- .../authentication/external/impl/AbstractDynamicTest.java | 3 ++- .../external/impl/principal/AbstractPrincipalTest.java | 3 ++- .../authorization/cug/impl/CugPermissionProviderTest.java | 5 +++-- .../spi/security/authorization/cug/impl/NestedCugHookTest.java | 9 +++++---- .../oak/spi/security/authorization/cug/impl/VersionTest.java | 3 ++- .../security/authorization/permission/PermissionHookTest.java | 9 +++++---- .../apache/jackrabbit/oak/security/user/MembershipBaseTest.java | 3 ++- .../org/apache/jackrabbit/oak/security/user/UserContextTest.java | 8 +++++--- .../jackrabbit/oak/security/user/action/GroupActionTest.java | 5 +++-- .../java/org/apache/jackrabbit/oak/jcr/ObservationQueueTest.java | 7 ++++--- .../oak/plugins/index/lucene/LucenePropertyIndexTest.java | 9 +++++---- .../lucene/directory/ConcurrentCopyOnReadDirectoryTest.java | 3 ++- .../oak/spi/security/authentication/AuthInfoImplTest.java | 3 ++- .../spi/security/principal/CompositePrincipalProviderTest.java | 7 ++++--- .../oak/spi/security/privilege/PrivilegeBitsProviderTest.java | 8 ++++---- .../apache/jackrabbit/oak/plugins/document/NodeDocumentTest.java | 4 ++-- 16 files changed, 52 insertions(+), 37 deletions(-) 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 f1f7521e58..78bfff9a5f 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,6 +16,7 @@ */ package org.apache.jackrabbit.oak.spi.security.authentication.external.impl; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.UserManager; @@ -88,7 +89,7 @@ public abstract class AbstractDynamicTest extends AbstractExternalAuthTest { DefaultSyncConfig sc = createSyncConfig(); UserManager um = getUserManager(r); // create automembership groups - for (String id : Iterables.concat(sc.user().getAutoMembership(), sc.group().getAutoMembership())) { + for (String id : IterableUtils.chainedIterable(sc.user().getAutoMembership(), sc.group().getAutoMembership())) { um.createGroup(id); } } diff --git a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/AbstractPrincipalTest.java b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/AbstractPrincipalTest.java index 49cc02ac3f..5de40f2dd3 100644 --- a/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/AbstractPrincipalTest.java +++ b/oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/AbstractPrincipalTest.java @@ -16,6 +16,7 @@ */ package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.api.security.principal.GroupPrincipal; import org.apache.jackrabbit.api.security.user.Group; @@ -81,7 +82,7 @@ public abstract class AbstractPrincipalTest extends AbstractExternalAuthTest { } @NotNull String[] getAutoMembership() { - return Iterables.toArray(Iterables.concat(syncConfig.user().getAutoMembership(),syncConfig.group().getAutoMembership()), String.class); + return Iterables.toArray(IterableUtils.chainedIterable(syncConfig.user().getAutoMembership(),syncConfig.group().getAutoMembership()), String.class); } @NotNull AutoMembershipConfig getAutoMembershipConfig() { 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 9d26e422a2..7563f6b5b1 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,6 +25,7 @@ import javax.jcr.AccessDeniedException; import javax.jcr.GuestCredentials; import javax.jcr.Session; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.oak.api.ContentSession; import org.apache.jackrabbit.oak.api.Root; @@ -519,7 +520,7 @@ public class CugPermissionProviderTest extends AbstractCugTest implements NodeTy */ @Test public void testHasNonReadPrivileges() { - for (String p : Iterables.concat(READABLE_PATHS, NOT_READABLE_PATHS)) { + for (String p : IterableUtils.chainedIterable(READABLE_PATHS, NOT_READABLE_PATHS)) { Tree tree = root.getTree(p); if (tree.exists()) { assertFalse(cugPermProvider.hasPrivileges(tree, PrivilegeConstants.JCR_WRITE)); @@ -646,7 +647,7 @@ public class CugPermissionProviderTest extends AbstractCugTest implements NodeTy */ @Test public void testIsGrantedNonRead() { - for (String p : Iterables.concat(READABLE_PATHS, NOT_READABLE_PATHS)) { + for (String p : IterableUtils.chainedIterable(READABLE_PATHS, NOT_READABLE_PATHS)) { Tree tree = root.getTree(p); if (tree.exists()) { assertFalse(cugPermProvider.isGranted(tree, null, Permissions.ALL)); 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 e5a8fef4bb..d5ea149261 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,6 +16,7 @@ */ package org.apache.jackrabbit.oak.spi.security.authorization.cug.impl; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.oak.api.Tree; import org.apache.jackrabbit.oak.api.Type; @@ -354,7 +355,7 @@ public class NestedCugHookTest extends AbstractCugTest { NodeState child = mock(NodeState.class); Iterable newCnes = Collections.singleton(new MemoryChildNodeEntry(":hidden", child)); - Iterable cnes = Iterables.concat(newCnes, before.getChildNodeEntries()); + Iterable cnes = IterableUtils.chainedIterable(newCnes, before.getChildNodeEntries()); when(after.getChildNodeEntries()).thenReturn(cnes); when(after.getChildNode(":hidden")).thenReturn(child); @@ -373,13 +374,13 @@ public class NestedCugHookTest extends AbstractCugTest { NodeState child = mock(NodeState.class); Iterable hidden = Collections.singleton(new MemoryChildNodeEntry(":hidden", child)); - Iterable cnes = Iterables.concat(hidden, nodeState.getChildNodeEntries()); + Iterable cnes = IterableUtils.chainedIterable(hidden, nodeState.getChildNodeEntries()); when(before.getChildNodeEntries()).thenReturn(cnes); when(before.getChildNode(":hidden")).thenReturn(child); NodeState child2 = when(mock(NodeState.class).exists()).thenReturn(true).getMock(); hidden = Collections.singleton(new MemoryChildNodeEntry(":hidden", child2)); - cnes = Iterables.concat(hidden, nodeState.getChildNodeEntries()); + cnes = IterableUtils.chainedIterable(hidden, nodeState.getChildNodeEntries()); when(after.getChildNodeEntries()).thenReturn(cnes); when(after.getChildNode(":hidden")).thenReturn(child2); @@ -398,7 +399,7 @@ public class NestedCugHookTest extends AbstractCugTest { NodeState child = mock(NodeState.class); Iterable deletedCnes = Collections.singleton(new MemoryChildNodeEntry(":hidden", child)); - Iterable cnes = Iterables.concat(deletedCnes, after.getChildNodeEntries()); + Iterable cnes = IterableUtils.chainedIterable(deletedCnes, after.getChildNodeEntries()); when(before.getChildNodeEntries()).thenReturn(cnes); when(before.getChildNode(":hidden")).thenReturn(child); 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 0a90e55253..3ef3291c85 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,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.oak.api.ContentSession; @@ -87,7 +88,7 @@ public class VersionTest extends AbstractCugTest implements NodeTypeConstants, V "/content/aa/bb" /* granted by ace, denied by cug */ ); - for (String path : Iterables.concat(readAccess, noReadAccess)) { + for (String path : IterableUtils.chainedIterable(readAccess, noReadAccess)) { addVersionContent(path); } diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java index f438104af8..3c968afb78 100644 --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java @@ -16,6 +16,7 @@ */ package org.apache.jackrabbit.oak.security.authorization.permission; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.api.security.JackrabbitAccessControlList; @@ -816,7 +817,7 @@ public class PermissionHookTest extends AbstractSecurityTest implements AccessCo NodeState child = mock(NodeState.class); Iterable newCnes = Collections.singleton(new MemoryChildNodeEntry(":hidden", child)); - Iterable cnes = Iterables.concat(newCnes, before.getChildNodeEntries()); + Iterable cnes = IterableUtils.chainedIterable(newCnes, before.getChildNodeEntries()); when(after.getChildNodeEntries()).thenReturn(cnes); when(after.getChildNode(":hidden")).thenReturn(child); @@ -836,13 +837,13 @@ public class PermissionHookTest extends AbstractSecurityTest implements AccessCo NodeState child = mock(NodeState.class); Iterable hidden = Collections.singleton(new MemoryChildNodeEntry(":hidden", child)); - Iterable cnes = Iterables.concat(hidden, nodeState.getChildNodeEntries()); + Iterable cnes = IterableUtils.chainedIterable(hidden, nodeState.getChildNodeEntries()); when(before.getChildNodeEntries()).thenReturn(cnes); when(before.getChildNode(":hidden")).thenReturn(child); NodeState child2 = when(mock(NodeState.class).exists()).thenReturn(true).getMock(); hidden = Collections.singleton(new MemoryChildNodeEntry(":hidden", child2)); - cnes = Iterables.concat(hidden, nodeState.getChildNodeEntries()); + cnes = IterableUtils.chainedIterable(hidden, nodeState.getChildNodeEntries()); when(after.getChildNodeEntries()).thenReturn(cnes); when(after.getChildNode(":hidden")).thenReturn(child2); @@ -861,7 +862,7 @@ public class PermissionHookTest extends AbstractSecurityTest implements AccessCo NodeState child = mock(NodeState.class); Iterable deletedCnes = Collections.singleton(new MemoryChildNodeEntry(":hidden", child)); - Iterable cnes = Iterables.concat(deletedCnes, after.getChildNodeEntries()); + Iterable cnes = IterableUtils.chainedIterable(deletedCnes, after.getChildNodeEntries()); when(before.getChildNodeEntries()).thenReturn(cnes); when(before.getChildNode(":hidden")).thenReturn(child); diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/MembershipBaseTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/MembershipBaseTest.java index c141ab042e..9261d443f2 100644 --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/MembershipBaseTest.java +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/MembershipBaseTest.java @@ -16,6 +16,7 @@ */ package org.apache.jackrabbit.oak.security.user; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.api.security.user.Authorizable; @@ -72,7 +73,7 @@ public abstract class MembershipBaseTest extends AbstractUserTest implements Use try { clearInvocations(monitor); root.refresh(); - for (String path : Iterables.concat(testUsers, testGroups)) { + for (String path : IterableUtils.chainedIterable(testUsers, testGroups)) { Authorizable auth = userMgr.getAuthorizableByPath(path); if (auth != null) { auth.remove(); 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 4afdd01266..205893f086 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,6 +21,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; + +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.oak.api.PropertyState; @@ -145,7 +147,7 @@ public class UserContextTest implements UserConstants { @Test public void testParentNotDefinesProperty() { - for (String propName : Iterables.concat(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) { + for (String propName : IterableUtils.chainedIterable(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) { PropertyState property = PropertyStates.createProperty(propName, "value"); for (String ntName : new String[] {NodeTypeConstants.NT_OAK_UNSTRUCTURED, NT_REP_AUTHORIZABLE_FOLDER}) { @@ -262,7 +264,7 @@ public class UserContextTest implements UserConstants { @Test public void testNonExistingTreeDefinesLocation2() { - for (String name : Iterables.concat(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) { + for (String name : IterableUtils.chainedIterable(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) { String path = "/some/path/endingWith/reservedName/" + name; for (String ntName : NT_NAMES) { @@ -279,7 +281,7 @@ public class UserContextTest implements UserConstants { @Test public void testNoTreeDefinesLocationReservedEnding() { - for (String name : Iterables.concat(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) { + for (String name : IterableUtils.chainedIterable(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) { String path = "/some/path/endingWith/reservedName/" + name; TreeLocation location = Mockito.mock(TreeLocation.class); when(location.getPath()).thenReturn(path); 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 302926740e..2814c6b287 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,6 +16,7 @@ */ package org.apache.jackrabbit.oak.security.user.action; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.api.security.user.Group; import org.apache.jackrabbit.api.security.user.User; @@ -120,7 +121,7 @@ public class GroupActionTest extends AbstractSecurityTest { Set<String> memberIds = Set.of(testUser01.getID()); Set<String> failedIds = Set.of(testUser02.getID(), testGroup.getID()); - Iterable<String> ids = Iterables.concat(memberIds, failedIds); + Iterable<String> ids = IterableUtils.chainedIterable(memberIds, failedIds); testGroup.addMembers(Iterables.toArray(ids, String.class)); @@ -143,7 +144,7 @@ public class GroupActionTest extends AbstractSecurityTest { Set<String> memberIds = Set.of(testUser01.getID()); Set<String> failedIds = Set.of(testUser02.getID(), testGroup.getID()); - Iterable<String> ids = Iterables.concat(memberIds, failedIds); + Iterable<String> ids = IterableUtils.chainedIterable(memberIds, failedIds); testGroup.removeMembers(Iterables.toArray(ids, String.class)); verify(groupAction, times(1)).onMembersRemoved(testGroup, memberIds, failedIds, root, getNamePathMapper()); diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ObservationQueueTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ObservationQueueTest.java index 0171a38508..3f55d7b2b2 100644 --- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ObservationQueueTest.java +++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ObservationQueueTest.java @@ -40,6 +40,7 @@ import javax.jcr.observation.EventListener; import javax.jcr.security.AccessControlManager; import javax.jcr.security.Privilege; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.guava.common.collect.Iterators; import org.apache.jackrabbit.api.JackrabbitSession; @@ -125,14 +126,14 @@ public class ObservationQueueTest extends AbstractClusterTest { Session s = loginUser(repos.next()); observers.add(new Thread(new Observer(s, queueLength))); } - for (Thread t : Iterables.concat(writers, readers, observers, loggers)) { + for (Thread t : IterableUtils.chainedIterable(writers, readers, observers, loggers)) { t.start(); } - for (Thread t : Iterables.concat(writers, readers)) { + for (Thread t : IterableUtils.chainedIterable(writers, readers)) { t.join(); } LOG.info("Writes stopped. Waiting for observers..."); - for (Thread t : Iterables.concat(observers, loggers)) { + for (Thread t : IterableUtils.chainedIterable(observers, loggers)) { t.join(); } for (Throwable t : exceptions) { diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java index e8baf83f30..e5292a302c 100644 --- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java +++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java @@ -43,6 +43,7 @@ import java.util.concurrent.Executors; import javax.jcr.PropertyType; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.ComparisonChain; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.guava.common.io.CountingInputStream; @@ -1107,9 +1108,9 @@ public class LucenePropertyIndexTest extends AbstractQueryTest { root.commit(); assertOrderedQuery("select [jcr:path] from [nt:base] where [bar] = 'baz' order by [foo]", ListUtils - .toList(Iterables.concat(List.of("/test/a"), getSortedPaths(tuples, OrderDirection.ASC)))); + .toList(IterableUtils.chainedIterable(List.of("/test/a"), getSortedPaths(tuples, OrderDirection.ASC)))); assertOrderedQuery("select [jcr:path] from [nt:base] where [bar] = 'baz' order by [foo] DESC", ListUtils - .toList(Iterables.concat(getSortedPaths(tuples, OrderDirection.DESC), List.of("/test/a")))); + .toList(IterableUtils.chainedIterable(getSortedPaths(tuples, OrderDirection.DESC), List.of("/test/a")))); } void assertSortedString() throws CommitFailedException { @@ -1197,10 +1198,10 @@ public class LucenePropertyIndexTest extends AbstractQueryTest { // Add the path of property added as timestamp string in the sorted list assertOrderedQuery("select [jcr:path] from [nt:base] where [bar] = 'baz' order by [foo]", ListUtils - .toList(Iterables.concat(List.of("/test/n0"), getSortedPaths(tuples, OrderDirection.ASC)))); + .toList(IterableUtils.chainedIterable(List.of("/test/n0"), getSortedPaths(tuples, OrderDirection.ASC)))); // Append the path of property added as timestamp string to the sorted list assertOrderedQuery("select [jcr:path] from [nt:base] where [bar] = 'baz' order by [foo] DESC", ListUtils - .toList(Iterables.concat(getSortedPaths(tuples, OrderDirection.DESC), List.of("/test/n0")))); + .toList(IterableUtils.chainedIterable(getSortedPaths(tuples, OrderDirection.DESC), List.of("/test/n0")))); } @Test diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/ConcurrentCopyOnReadDirectoryTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/ConcurrentCopyOnReadDirectoryTest.java index 30a2117c61..401fe62e03 100644 --- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/ConcurrentCopyOnReadDirectoryTest.java +++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/ConcurrentCopyOnReadDirectoryTest.java @@ -16,6 +16,7 @@ */ package org.apache.jackrabbit.oak.plugins.index.lucene.directory; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.oak.InitialContentHelper; import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser; @@ -124,7 +125,7 @@ public class ConcurrentCopyOnReadDirectoryTest { waitForLeechingCoRsToFinish(); - for (Directory d : Iterables.concat(Collections.singleton(firstCoR), leechingCoRs)) { + for (Directory d : IterableUtils.chainedIterable(Collections.singleton(firstCoR), leechingCoRs)) { IndexInput input = d.openInput("file", IOContext.READ); assertFalse(d + " must not be reading from remote", input.toString().startsWith(REMOTE_INPUT_PREFIX)); diff --git a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthInfoImplTest.java b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthInfoImplTest.java index a8fb7711fd..12a72141c7 100644 --- a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthInfoImplTest.java +++ b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthInfoImplTest.java @@ -25,6 +25,7 @@ import javax.jcr.Credentials; import javax.jcr.SimpleCredentials; import javax.security.auth.Subject; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.oak.api.AuthInfo; import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl; @@ -128,7 +129,7 @@ public class AuthInfoImplTest { @Test public void testCreateFromPrincipalIterables() { - AuthInfo info = new AuthInfoImpl(USER_ID, ATTRIBUTES, Iterables.concat(PRINCIPALS, Collections.emptyList())); + AuthInfo info = new AuthInfoImpl(USER_ID, ATTRIBUTES, IterableUtils.chainedIterable(PRINCIPALS, Collections.emptyList())); assertEquals(authInfo.toString(), info.toString()); } 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 edc9369b3e..4fd1db96bb 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,6 +27,7 @@ import java.util.Random; import java.util.Set; import java.util.TreeSet; +import org.apache.commons.collections4.IterableUtils; import org.apache.jackrabbit.guava.common.collect.Iterables; import org.apache.jackrabbit.api.security.principal.GroupPrincipal; @@ -55,7 +56,7 @@ public class CompositePrincipalProviderTest { private final PrincipalProvider cpp = CompositePrincipalProvider.of(List.<PrincipalProvider>of(pp1, pp2)); private Iterable<Principal> testPrincipals() { - return Iterables.concat(pp1.getTestPrincipals(), pp2.getTestPrincipals()); + return IterableUtils.chainedIterable(pp1.getTestPrincipals(), pp2.getTestPrincipals()); } private static void assertIterator(@NotNull Iterable<? extends Principal> expected, @NotNull Iterator<? extends Principal> result) { @@ -136,7 +137,7 @@ public class CompositePrincipalProviderTest { @Test public void findPrincipalsByTypeGroup() { - Iterable<? extends Principal> expected = Iterables.concat(Set.of(EveryonePrincipal.getInstance()), Iterables.filter(testPrincipals(), + Iterable<? extends Principal> expected = IterableUtils.chainedIterable(Set.of(EveryonePrincipal.getInstance()), Iterables.filter(testPrincipals(), input -> input instanceof GroupPrincipal)); Iterator<? extends Principal> result = cpp.findPrincipals(PrincipalManager.SEARCH_TYPE_GROUP); @@ -154,7 +155,7 @@ public class CompositePrincipalProviderTest { @Test public void findPrincipalsByTypeAll() { Iterator<? extends Principal> result = cpp.findPrincipals(PrincipalManager.SEARCH_TYPE_ALL); - assertIterator(Iterables.concat(Set.of(EveryonePrincipal.getInstance()), testPrincipals()), result); + assertIterator(IterableUtils.chainedIterable(Set.of(EveryonePrincipal.getInstance()), testPrincipals()), result); } /** 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 f891ad4601..7c122e5725 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 @@ -417,7 +417,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants { @Test public void testGetAggregatedPrivilegeNamesMultipleBuiltIn() { - Iterable<String> expected = SetUtils.toSet(Iterables.concat( + Iterable<String> expected = SetUtils.toSet(IterableUtils.chainedIterable( bitsProvider.getAggregatedPrivilegeNames(JCR_READ), bitsProvider.getAggregatedPrivilegeNames(JCR_WRITE))); @@ -429,7 +429,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants { @Test public void testGetAggregatedPrivilegeNamesMultipleBuiltIn2() { - Iterable<String> expected = SetUtils.toSet(Iterables.concat( + Iterable<String> expected = SetUtils.toSet(IterableUtils.chainedIterable( bitsProvider.getAggregatedPrivilegeNames(JCR_READ), bitsProvider.getAggregatedPrivilegeNames(JCR_WRITE))); @@ -440,7 +440,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants { @Test public void testGetAggregatedPrivilegeNamesMixedBuiltIn() { - Iterable<String> expected = SetUtils.toSet(Iterables.concat( + Iterable<String> expected = SetUtils.toSet(IterableUtils.chainedIterable( Set.of(JCR_LOCK_MANAGEMENT), bitsProvider.getAggregatedPrivilegeNames(JCR_WRITE))); @@ -498,7 +498,7 @@ public class PrivilegeBitsProviderTest implements PrivilegeConstants { when(privTree.getChild(KNOWN_PRIV_NAME)).thenReturn(pTree); Iterable<String> result = bitsProvider.getAggregatedPrivilegeNames(KNOWN_PRIV_NAME); - Set<String> expected = SetUtils.toSet(Iterables.concat( + Set<String> expected = SetUtils.toSet(IterableUtils.chainedIterable( Set.of(JCR_ADD_CHILD_NODES), bitsProvider.getAggregatedPrivilegeNames(JCR_READ))); diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentTest.java index 5535bb9715..db2c29e615 100644 --- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentTest.java +++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentTest.java @@ -1068,7 +1068,7 @@ public class NodeDocumentTest { // do not yet merge, but create more test data int numMoreChanges = 50; List<RevisionVector> moreRevs = ListUtils.reverse(createTestData(nodeStores, random, numMoreChanges, numChanges)); - headRevisions = ListUtils.toList(Iterables.concat(moreRevs, headRevisions)); + headRevisions = ListUtils.toList(IterableUtils.chainedIterable(moreRevs, headRevisions)); numChanges += numMoreChanges; // now merge the branch and update 'q'. this will split @@ -1081,7 +1081,7 @@ public class NodeDocumentTest { // and create yet more test data numMoreChanges = 50; moreRevs = ListUtils.reverse(createTestData(nodeStores, random, numMoreChanges, numChanges)); - headRevisions = ListUtils.toList(Iterables.concat(moreRevs, headRevisions)); + headRevisions = ListUtils.toList(IterableUtils.chainedIterable(moreRevs, headRevisions)); numChanges += numMoreChanges; NodeDocument doc = getRootDocument(store);
