Skip to content

Commit

Permalink
Merge pull request #1934 from apache/OAK-11335
Browse files Browse the repository at this point in the history
OAK-11335 : removed usage of Guava's Lists.asList with Stream API
  • Loading branch information
rishabhdaim authored Jan 6, 2025
2 parents 28e5c03 + c831560 commit 179728b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.security.authorization.restriction;

import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.jetbrains.annotations.NotNull;
Expand All @@ -26,6 +25,8 @@
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -152,7 +153,7 @@ public void testNotEquals() {
assertNotEquals(pattern, new SubtreePattern(PATH, Collections.emptyList()));
assertNotEquals(pattern, new SubtreePattern(PATH, Collections.singleton("/some/other/subtree")));
assertNotEquals(pattern, new SubtreePattern(PATH, SUBTREES.subList(0, 2)));
assertNotEquals(pattern, new SubtreePattern(PATH, Lists.asList("/subtree/", SUBTREES.toArray(new String[0]))));
assertNotEquals(pattern, new SubtreePattern(PATH, Stream.concat(Stream.of("/subtree/"), SUBTREES.stream()).collect(Collectors.toList())));
// different restrictions
assertNotEquals(pattern, new ItemNamePattern(Set.of("a", "b")));
assertNotEquals(pattern, new PrefixPattern(Set.of("a", "b", "c")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@

package org.apache.jackrabbit.oak.jcr;

import static org.apache.jackrabbit.guava.common.collect.Lists.asList;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
import static org.apache.jackrabbit.oak.api.Type.NAME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.jcr.Node;
import javax.jcr.NodeIterator;
Expand Down Expand Up @@ -170,4 +172,9 @@ public void renameSiblings() throws RepositoryException {
assertTrue(sns.hasNode(rename(name)));
}
}

// helper methods
private List<String> asList(final String s1, final String[] sArr) {
return Stream.concat(Stream.of(s1), Stream.of(sArr)).collect(Collectors.toList());
}
}

0 comments on commit 179728b

Please sign in to comment.