Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl.principal;

import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
import org.apache.jackrabbit.oak.spi.security.authentication.external.impl.SyncHandlerMapping;
import org.junit.Before;
Expand Down Expand Up @@ -49,21 +49,21 @@ public void before() {
@Test
public void testAddingServiceWithoutProperties() {
tracker.addingService(ref);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}

@Test
public void testAddingServiceWithIdpProp() {
when(ref.getProperty(PARAM_IDP_NAME)).thenReturn("testIDP");
tracker.addingService(ref);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}

@Test
public void testAddingServiceWithSyncHandlerProp() {
when(ref.getProperty(PARAM_SYNC_HANDLER_NAME)).thenReturn("testSH");
tracker.addingService(ref);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}

@Test
Expand Down Expand Up @@ -94,21 +94,21 @@ public void testAddingServiceWithProperties() {
@Test
public void testModifiedServiceWithoutProperties() {
tracker.modifiedService(ref, service);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}

@Test
public void testModifiedServiceWithIdpProp() {
when(ref.getProperty(PARAM_IDP_NAME)).thenReturn("testIDP");
tracker.modifiedService(ref, service);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}

@Test
public void testModifiedServiceWithSyncHandlerProp() {
when(ref.getProperty(PARAM_SYNC_HANDLER_NAME)).thenReturn("testSH");
tracker.modifiedService(ref, service);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}

@Test
Expand All @@ -126,7 +126,7 @@ public void testModifiedServiceWithProperties() {
when(ref.getProperty(PARAM_SYNC_HANDLER_NAME)).thenReturn("testSH-3");
when(ref.getProperty(PARAM_IDP_NAME)).thenReturn("testIDP-3");
tracker.modifiedService(ref, service);
assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
assertEquals(Set.of("testIDP-3"), SetUtils.toSet(tracker.getIdpNames("testSH-3")));
}

Expand All @@ -138,6 +138,6 @@ public void testRemovedService() {
tracker.addingService(ref);
tracker.removedService(ref, service);

assertTrue(Iterables.isEmpty(tracker.getIdpNames("testSH")));
assertTrue(IterableUtils.isEmpty(tracker.getIdpNames("testSH")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.jackrabbit.oak.security.authentication.ldap.impl;

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.oak.commons.collections.SetUtils;
Expand Down Expand Up @@ -211,7 +212,7 @@ public void testGetDeclaredMembersInvalidMemberAttribute() throws Exception {

ExternalGroup gr = idp.getGroup(TEST_GROUP1_NAME);
Iterable<ExternalIdentityRef> memberrefs = gr.getDeclaredMembers();
assertTrue(Iterables.isEmpty(memberrefs));
assertTrue(IterableUtils.isEmpty(memberrefs));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.util.HashSet;
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.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
Expand Down Expand Up @@ -294,7 +296,7 @@ public boolean childNodeDeleted(String name, NodeState before) {
// are still present.
Set<String> reconnect = getCugPathsToReconnect(before);
if (isRoot) {
if (!Iterables.isEmpty(reconnect)) {
if (!IterableUtils.isEmpty(reconnect)) {
afterBuilder.setProperty(HIDDEN_NESTED_CUGS, reconnect, Type.STRINGS);
afterBuilder.setProperty(HIDDEN_TOP_CUG_CNT, reconnect.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;

import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
import org.apache.jackrabbit.oak.api.CommitFailedException;
Expand Down Expand Up @@ -221,7 +221,7 @@ private void validateEntry(@NotNull String name, @NotNull NodeState nodeState) t
throw accessControlViolation(36, "Isolated entry of principal policy at " + entryPath);
}
Iterable<String> privilegeNames = nodeState.getNames(REP_PRIVILEGES);
if (Iterables.isEmpty(privilegeNames)) {
if (IterableUtils.isEmpty(privilegeNames)) {
throw accessControlViolation(37, "Empty rep:privileges property at " + entryPath);
}
PrivilegeManager privilegeManager = mgrProvider.getPrivilegeManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;

import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.commons.PathUtils;
Expand Down Expand Up @@ -474,7 +474,7 @@ public void testEndWithPolicyAndValidTree() throws Exception {
policyTree = root.getTree(policyTree.getPath());
assertTrue(policyTree.exists());
assertTrue(policyTree.hasProperty(REP_PRINCIPAL_NAME));
assertTrue(Iterables.isEmpty(policyTree.getChildren()));
assertTrue(IterableUtils.isEmpty(policyTree.getChildren()));
}

@Test(expected = IllegalStateException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.apache.jackrabbit.guava.common.collect.Iterables.addAll;
import static org.apache.jackrabbit.guava.common.collect.Iterables.contains;
import static org.apache.jackrabbit.guava.common.collect.Iterables.isEmpty;
import static java.util.Collections.emptyList;
import static org.apache.jackrabbit.JcrConstants.JCR_CHILDNODEDEFINITION;
import static org.apache.jackrabbit.JcrConstants.JCR_ISMIXIN;
Expand Down Expand Up @@ -66,6 +65,7 @@
import java.util.List;
import java.util.Set;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
Expand Down Expand Up @@ -253,7 +253,7 @@ private void ensureNtBase(NodeBuilder types, NodeBuilder type) {
// This is a primary node type.
// Make sure jcr:supertypes contains nt:base when needed.
Iterable<String> supertypes = getNames(type, JCR_SUPERTYPES);
if (isEmpty(supertypes)) {
if (IterableUtils.isEmpty(supertypes)) {
addNameToList(type, JCR_SUPERTYPES, NT_BASE);
} else {
// is any of the supertypes a primary node type?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.jcr.security.AccessControlException;
import javax.jcr.security.Privilege;

import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
Expand Down Expand Up @@ -270,7 +271,7 @@ private void checkValidPrivileges(@NotNull Tree aceNode) throws CommitFailedExce
@NotNull
private static Iterable<String> getPrivilegeNames(@NotNull Tree aceNode) throws CommitFailedException {
Iterable<String> privilegeNames = TreeUtil.getNames(aceNode, REP_PRIVILEGES);
if (Iterables.isEmpty(privilegeNames)) {
if (IterableUtils.isEmpty(privilegeNames)) {
throw accessViolation(9, "Missing privileges at " + aceNode.getPath());
}
return privilegeNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Arrays;
import java.util.Set;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
import org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate;
import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
Expand All @@ -50,8 +51,6 @@
import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.junit.Test;

import org.apache.jackrabbit.guava.common.collect.Iterables;

/**
* Test the asynchronous reindexing ability of an synchronous index
*/
Expand All @@ -64,7 +63,7 @@ public class AsyncPropertyIndexTest {
@Test
public void testAsyncPropertyLookup() throws Exception {
NodeStore store = new MemoryNodeStore();
assertTrue(Iterables.isEmpty(store.checkpoints()));
assertTrue(IterableUtils.isEmpty(store.checkpoints()));

NodeBuilder builder = store.getRoot().builder();

Expand Down Expand Up @@ -103,7 +102,7 @@ public void testAsyncPropertyLookup() throws Exception {
async.close();
assertEquals(null, store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME)
.getChildNode("foo").getString(ASYNC_PROPERTY_NAME));
assertTrue(Iterables.isEmpty(store.checkpoints()));
assertTrue(IterableUtils.isEmpty(store.checkpoints()));

// add content, it should be indexed synchronously
builder = store.getRoot().builder();
Expand Down Expand Up @@ -131,12 +130,12 @@ private static Set<String> find(PropertyIndexLookup lookup, String name,
@Test
public void testAsyncPropertyNoChanges() throws Exception {
NodeStore store = new MemoryNodeStore();
assertTrue(Iterables.isEmpty(store.checkpoints()));
assertTrue(IterableUtils.isEmpty(store.checkpoints()));
AsyncIndexUpdate async = new AsyncIndexUpdate(ASYNC_REINDEX_VALUE,
store, provider, true);
async.run();
async.run();
async.close();
assertTrue(Iterables.isEmpty(store.checkpoints()));
assertTrue(IterableUtils.isEmpty(store.checkpoints()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.tree.impl;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
Expand Down Expand Up @@ -122,8 +123,8 @@ protected Tree createValue() {

@Test
public void testGetMixinTypeNamesMissingAccessible() {
assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(root.getTree("/"))));
assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(root.getTree("/"), new LazyValue<Tree>() {
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(root.getTree("/"))));
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(root.getTree("/"), new LazyValue<Tree>() {
@Override
protected Tree createValue() {
return root.getTree("/");
Expand All @@ -134,12 +135,12 @@ protected Tree createValue() {
@Test
public void testGetMixinTypeNamesMissingNotAccessible() throws Exception {
Tree tree = root.getTree("/");
assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(tree)));
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(tree)));

try (ContentSession cs = login(new GuestCredentials())) {
Root guestRoot = cs.getLatestRoot();
assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(guestRoot.getTree("/"))));
assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(guestRoot.getTree("/"), new LazyValue<Tree>() {
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(guestRoot.getTree("/"))));
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(guestRoot.getTree("/"), new LazyValue<Tree>() {
@Override
protected Tree createValue() {
return tree;
Expand Down Expand Up @@ -177,7 +178,7 @@ public void testGetMixinTypeNamesPresentNotAccessible() throws Exception {

try (ContentSession cs = login(new GuestCredentials())) {
Root guestRoot = cs.getLatestRoot();
assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(guestRoot.getTree(path))));
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(guestRoot.getTree(path))));
assertTrue(Iterables.elementsEqual(expected, TreeUtil.getMixinTypeNames(guestRoot.getTree(path), new LazyValue<Tree>() {
@Override
protected Tree createValue() {
Expand All @@ -197,7 +198,7 @@ public void testGetMixinTypeNamesPresentNotAccessibleNew() throws Exception {
when(t.hasProperty(JcrConstants.JCR_MIXINTYPES)).thenReturn(false);
when(t.getStatus()).thenReturn(Tree.Status.NEW);

assertTrue(Iterables.isEmpty(TreeUtil.getMixinTypeNames(t, new LazyValue<Tree>() {
assertTrue(IterableUtils.isEmpty(TreeUtil.getMixinTypeNames(t, new LazyValue<Tree>() {
@Override
protected Tree createValue() {
return testTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.jackrabbit.oak.jcr.observation;

import static org.apache.jackrabbit.guava.common.collect.Iterables.isEmpty;
import static org.apache.jackrabbit.guava.common.collect.Iterables.toArray;
import static java.util.Collections.emptyMap;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
Expand All @@ -35,6 +34,7 @@
import javax.jcr.Value;
import javax.jcr.observation.Event;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.api.observation.JackrabbitEvent;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.blob.BlobAccessProvider;
Expand Down Expand Up @@ -221,7 +221,7 @@ public int getType() {
}

private Map<String, ?> createInfoMap(String primaryType, Iterable<String> mixinTypes) {
if (isEmpty(mixinTypes)) {
if (IterableUtils.isEmpty(mixinTypes)) {
return Map.of(
JCR_PRIMARYTYPE, mapper.getJcrName(primaryType));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.jackrabbit.oak.plugins.index.lucene.hybrid;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.HashMultimap;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Multimap;
Expand All @@ -40,7 +41,7 @@ public class LuceneJournalPropertyBuilderTest {
public void nullProperty() throws Exception{
builder.addProperty(null);
assertEquals("{}", builder.buildAsString());
assertTrue(Iterables.isEmpty(((IndexedPaths)builder.build())));
assertTrue(IterableUtils.isEmpty(((IndexedPaths)builder.build())));
}

@Test
Expand All @@ -51,7 +52,7 @@ public void nullOrEmptyJson() throws Exception{
builder2.addSerializedProperty(null);
builder2.addSerializedProperty(builder.buildAsString());

assertTrue(Iterables.isEmpty(((IndexedPaths)builder2.build())));
assertTrue(IterableUtils.isEmpty(((IndexedPaths)builder2.build())));
}
@Test
public void addJsonLessThanMaxBuilderSize() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.jackrabbit.oak.plugins.index.search;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.IllegalRepositoryStateException;
Expand Down Expand Up @@ -1617,7 +1618,7 @@ private static NodeBuilder createIndexRules(NodeState defn) {
//Also include all immediate leaf propNode names
for (ChildNodeEntry cne : propNodeState.getChildNodeEntries()) {
if (!propNamesSet.contains(cne.getName())
&& Iterables.isEmpty(cne.getNodeState().getChildNodeNames())) {
&& IterableUtils.isEmpty(cne.getNodeState().getChildNodeNames())) {
propNamesSet.add(cne.getName());
}
}
Expand Down
4 changes: 4 additions & 0 deletions oak-security-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.jcr.security.AccessControlException;
import javax.jcr.security.Privilege;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.FluentIterable;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
Expand Down Expand Up @@ -91,7 +92,7 @@ public PrivilegeBits getBits(@NotNull String... privilegeNames) {
*/
@NotNull
public PrivilegeBits getBits(@NotNull Iterable<String> privilegeNames) {
if (Iterables.isEmpty(privilegeNames)) {
if (IterableUtils.isEmpty(privilegeNames)) {
return PrivilegeBits.EMPTY;
}

Expand All @@ -116,7 +117,7 @@ public PrivilegeBits getBits(@NotNull Iterable<String> privilegeNames, boolean v
if (!validateNames) {
return getBits(privilegeNames);
}
if (Iterables.isEmpty(privilegeNames)) {
if (IterableUtils.isEmpty(privilegeNames)) {
return PrivilegeBits.EMPTY;
}
PrivilegeBits bits = PrivilegeBits.getInstance();
Expand Down
Loading
Loading