Skip to content

Commit

Permalink
OAK-11384 : removed usage of Guava's Maps.difference (#1977)
Browse files Browse the repository at this point in the history
Co-authored-by: Rishabh Kumar <[email protected]>
  • Loading branch information
rishabhdaim and Rishabh Kumar authored Jan 13, 2025
1 parent 1021db4 commit bad4936
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*/
package org.apache.jackrabbit.oak.security.authentication;

import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.osgi.OsgiUtil;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
import org.junit.Rule;
Expand All @@ -27,8 +25,10 @@

import javax.jcr.SimpleCredentials;

import java.util.Map;
import java.util.Objects;

import static org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration.PARAM_APP_NAME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class AuthenticationConfigurationImplOSGiTest extends AbstractSecurityTest {
Expand All @@ -54,6 +54,16 @@ public void testGetParameters() {
ConfigurationParameters expected = ConfigurationParameters.of(
PARAM_APP_NAME, "name",
Constants.SERVICE_PID, authenticationConfiguration.getClass().getName());
assertTrue(Maps.difference(expected, authenticationConfiguration.getParameters()).areEqual());
assertTrue(areEqual(expected, authenticationConfiguration.getParameters()));
}

// helper methods
private boolean areEqual(Map<String, Object> first, Map<String, Object> second) {
if (first.size() != second.size()) {
return false;
}

return first.entrySet().stream()
.allMatch(e -> Objects.equals(e.getValue(), second.get(e.getKey())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Map;
import java.util.Properties;

import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.guava.common.io.Closer;
import org.apache.jackrabbit.guava.common.io.Files;
import org.apache.commons.io.FileUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
import org.apache.jackrabbit.oak.stats.StatisticsProvider;

import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.guava.common.io.Closer;
import org.apache.jackrabbit.guava.common.io.Files;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@

import javax.jcr.RepositoryException;

import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.core.data.DataStoreException;
import org.apache.jackrabbit.oak.blob.cloud.s3.S3DataStore;
import org.apache.jackrabbit.oak.commons.PropertiesUtil;
import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;

import org.apache.jackrabbit.guava.common.io.Closer;
import org.apache.jackrabbit.guava.common.io.Files;
import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
Expand Down

0 comments on commit bad4936

Please sign in to comment.