Skip to content

Commit

Permalink
Merge pull request #249 from dfish3r/ldaptive-v2.4.0
Browse files Browse the repository at this point in the history
Update ldaptive to v2.4.0
  • Loading branch information
mchyzer authored Jan 4, 2025
2 parents 53924f5 + e5b531a commit bfb9ecb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion grouper-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<p6spy.version>3.6.0</p6spy.version>
<postgresql.version>42.7.2</postgresql.version>
<mysql.connector.java.version>8.0.33</mysql.connector.java.version>
<ldaptive.version>2.4.0-SNAPSHOT</ldaptive.version>
<ldaptive.version>2.4.0</ldaptive.version>
<unboundid.version>6.0.10</unboundid.version>
<!-- if you change this version make sure container substitution still works -->
<playwright.version>1.46.0</playwright.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import java.util.List;
import java.util.Properties;
import edu.internet2.middleware.grouper.app.loader.GrouperLoaderConfig;
import edu.internet2.middleware.grouperClient.config.db.ConfigDatabaseLogic;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.ldaptive.BindConnectionInitializer;
import org.ldaptive.PooledConnectionFactory;
Expand All @@ -33,12 +35,24 @@
import org.ldaptive.handler.LdapEntryHandler;
import org.ldaptive.handler.SearchResultHandler;
import org.ldaptive.sasl.Mechanism;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import static org.mockito.ArgumentMatchers.anyString;

/**
* Unit test for {@link LdaptiveConfiguration}.
*/
public class LdaptiveConfigurationTest {

/** Mock to prevent database initialization. */
private static MockedStatic<ConfigDatabaseLogic> databaseLoader;

@BeforeClass
public static void setup() throws Exception {
databaseLoader = Mockito.mockStatic(ConfigDatabaseLogic.class);
databaseLoader.when(() -> ConfigDatabaseLogic.retrieveConfigInputStream(anyString())).thenReturn(null);
}

/**
* Store configuration properties in {@link GrouperLoaderConfig}.
*
Expand Down Expand Up @@ -76,7 +90,7 @@ public void useStartTLSFalse() throws Exception {
Assert.assertNull(factory.getConnectionConfig().getSslConfig());
Assert.assertNull(factory.getConnectionConfig().getConnectionInitializers());
SearchConnectionValidator validator = (SearchConnectionValidator) factory.getValidator();
Assert.assertEquals(Duration.ofMinutes(30), validator.getValidatePeriod());
Assert.assertEquals(Duration.ofMinutes(5), validator.getValidatePeriod());
}

@Test
Expand All @@ -99,7 +113,7 @@ public void useStartTLSTrue() throws Exception {
Assert.assertNull(factory.getConnectionConfig().getSslConfig());
Assert.assertNull(factory.getConnectionConfig().getConnectionInitializers());
SearchConnectionValidator validator = (SearchConnectionValidator) factory.getValidator();
Assert.assertEquals(Duration.ofMinutes(30), validator.getValidatePeriod());
Assert.assertEquals(Duration.ofMinutes(5), validator.getValidatePeriod());
}

@Test
Expand Down Expand Up @@ -127,7 +141,7 @@ public void bindCredentials() throws Exception {
Assert.assertEquals("mysecret", initializer.getBindCredential().getString());
Assert.assertNull(initializer.getBindSaslConfig());
SearchConnectionValidator validator = (SearchConnectionValidator) factory.getValidator();
Assert.assertEquals(Duration.ofMinutes(30), validator.getValidatePeriod());
Assert.assertEquals(Duration.ofMinutes(5), validator.getValidatePeriod());
}

@Test
Expand Down Expand Up @@ -158,7 +172,7 @@ public void credentialConfig() throws Exception {
Assert.assertEquals("/tmp/keyfile", credentialConfig.getKeyFile());
Assert.assertNull(factory.getConnectionConfig().getConnectionInitializers());
SearchConnectionValidator validator = (SearchConnectionValidator) factory.getValidator();
Assert.assertEquals(Duration.ofMinutes(30), validator.getValidatePeriod());
Assert.assertEquals(Duration.ofMinutes(5), validator.getValidatePeriod());
}

@Test
Expand Down Expand Up @@ -189,7 +203,7 @@ public void saslConfig() throws Exception {
Assert.assertEquals(Mechanism.DIGEST_MD5, initializer.getBindSaslConfig().getMechanism());
Assert.assertEquals("myrealm", initializer.getBindSaslConfig().getRealm());
SearchConnectionValidator validator = (SearchConnectionValidator) factory.getValidator();
Assert.assertEquals(Duration.ofMinutes(30), validator.getValidatePeriod());
Assert.assertEquals(Duration.ofMinutes(5), validator.getValidatePeriod());
}

@Test
Expand Down

0 comments on commit bfb9ecb

Please sign in to comment.