This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new dce4acc5f27 HBASE-29548 Update ApacheDS to 2.0.0.AM27 and ldap-api to
2.1.7 (#7312)
dce4acc5f27 is described below
commit dce4acc5f274e6ef05b7e28cf565553c173eac4c
Author: Istvan Toth <[email protected]>
AuthorDate: Thu Sep 18 08:14:33 2025 +0200
HBASE-29548 Update ApacheDS to 2.0.0.AM27 and ldap-api to 2.1.7 (#7312)
Signed-off-by: Nihal Jain <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
---
hbase-http/pom.xml | 4 ++
.../hadoop/hbase/http/LdapServerTestBase.java | 61 ++++++++++++++++++----
.../apache/hadoop/hbase/http/TestLdapAdminACL.java | 23 ++++----
.../hadoop/hbase/http/TestLdapHttpServer.java | 20 +++----
pom.xml | 4 +-
5 files changed, 74 insertions(+), 38 deletions(-)
diff --git a/hbase-http/pom.xml b/hbase-http/pom.xml
index 7dfdd25dc64..bcbcb4d5cba 100644
--- a/hbase-http/pom.xml
+++ b/hbase-http/pom.xml
@@ -486,6 +486,10 @@
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/LdapServerTestBase.java
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/LdapServerTestBase.java
index bbf35b8585f..8856aaa0e20 100644
---
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/LdapServerTestBase.java
+++
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/LdapServerTestBase.java
@@ -21,34 +21,73 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.commons.codec.binary.Base64;
-import org.apache.directory.server.core.integ.CreateLdapServerRule;
+import org.apache.directory.ldap.client.template.LdapConnectionTemplate;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.integ.ApacheDSTestExtension;
+import org.apache.directory.server.ldap.LdapServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.http.resource.JerseyResource;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Base class for setting up and testing an HTTP server with LDAP
authentication.
*/
+@ExtendWith(ApacheDSTestExtension.class)
public class LdapServerTestBase extends HttpServerFunctionalTest {
private static final Logger LOG =
LoggerFactory.getLogger(LdapServerTestBase.class);
- @ClassRule
- public static CreateLdapServerRule ldapRule = new CreateLdapServerRule();
-
protected static HttpServer server;
protected static URL baseUrl;
+ /**
+ * The following fields are set by ApacheDSTestExtension. These are normally
inherited from
+ * AbstractLdapTestUnit, but this class already has a parent. We only use
ldapServer, but
+ * declaring that one alone does not work.
+ */
+
+ /** The class DirectoryService instance */
+ public static DirectoryService classDirectoryService;
+
+ /** The test DirectoryService instance */
+ public static DirectoryService methodDirectoryService;
+
+ /** The current DirectoryService instance */
+ public static DirectoryService directoryService;
+
+ /** The class LdapServer instance */
+ public static LdapServer classLdapServer;
+
+ /** The test LdapServer instance */
+ public static LdapServer methodLdapServer;
+
+ /** The current LdapServer instance */
+ public static LdapServer ldapServer;
+
+ /** The Ldap connection template */
+ public static LdapConnectionTemplate ldapConnectionTemplate;
+
+ /** The current revision */
+ public static long revision = 0L;
+
+ /**
+ * End of fields required by ApacheDSTestExtension
+ */
+
private static final String AUTH_TYPE = "Basic ";
+ protected static LdapServer getLdapServer() {
+ return classLdapServer;
+ }
+
/**
* Sets up the HTTP server with LDAP authentication before any tests are run.
* @throws Exception if an error occurs during server setup
*/
- @BeforeClass
+ @BeforeAll
public static void setupServer() throws Exception {
Configuration conf = new Configuration();
setLdapConfigurations(conf);
@@ -66,7 +105,7 @@ public class LdapServerTestBase extends
HttpServerFunctionalTest {
* Stops the HTTP server after all tests are completed.
* @throws Exception if an error occurs during server shutdown
*/
- @AfterClass
+ @AfterAll
public static void stopServer() throws Exception {
try {
if (null != server) {
@@ -90,8 +129,8 @@ public class LdapServerTestBase extends
HttpServerFunctionalTest {
conf.set(HttpServer.FILTER_INITIALIZERS_PROPERTY,
"org.apache.hadoop.hbase.http.lib.AuthenticationFilterInitializer");
conf.set("hadoop.http.authentication.type", "ldap");
- conf.set("hadoop.http.authentication.ldap.providerurl",
String.format("ldap://%s:%s",
- LdapConstants.LDAP_SERVER_ADDR, ldapRule.getLdapServer().getPort()));
+ conf.set("hadoop.http.authentication.ldap.providerurl",
+ String.format("ldap://%s:%s", LdapConstants.LDAP_SERVER_ADDR,
getLdapServer().getPort()));
conf.set("hadoop.http.authentication.ldap.enablestarttls", "false");
conf.set("hadoop.http.authentication.ldap.basedn",
LdapConstants.LDAP_BASE_DN);
}
diff --git
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapAdminACL.java
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapAdminACL.java
index 45986550963..900c1fef07b 100644
---
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapAdminACL.java
+++
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapAdminACL.java
@@ -17,10 +17,11 @@
*/
package org.apache.hadoop.hbase.http;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.net.HttpURLConnection;
+import java.util.concurrent.TimeUnit;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -29,21 +30,19 @@ import
org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreatePartition;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.http.resource.JerseyResource;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Test class for admin ACLs with LDAP authentication on the HttpServer.
*/
-@Category({ MiscTests.class, SmallTests.class })
+@Tag("org.apache.hadoop.hbase.testclassification.MiscTests")
+@Tag("org.apache.hadoop.hbase.testclassification.SmallTests")
@CreateLdapServer(
transports = { @CreateTransport(protocol = "LDAP", address =
LdapConstants.LDAP_SERVER_ADDR), })
@CreateDS(name = "TestLdapAdminACL", allowAnonAccess = true,
@@ -55,18 +54,16 @@ import org.slf4j.LoggerFactory;
"dn: uid=jdoe," + LdapConstants.LDAP_BASE_DN, "cn: John Doe", "sn: Doe",
"objectClass: inetOrgPerson", "uid: jdoe", "userPassword: secure123" })
+@Timeout(value = 1, unit = TimeUnit.MINUTES)
public class TestLdapAdminACL extends LdapServerTestBase {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestLdapAdminACL.class);
private static final Logger LOG =
LoggerFactory.getLogger(TestLdapAdminACL.class);
private static final String ADMIN_CREDENTIALS = "bjones:p@ssw0rd";
private static final String NON_ADMIN_CREDENTIALS = "jdoe:secure123";
private static final String WRONG_CREDENTIALS = "bjones:password";
- @BeforeClass
+ @BeforeAll
public static void setupServer() throws Exception {
Configuration conf = new Configuration();
setLdapConfigurationWithACLs(conf);
diff --git
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapHttpServer.java
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapHttpServer.java
index bff4dc9d959..66b3b2924ee 100644
---
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapHttpServer.java
+++
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestLdapHttpServer.java
@@ -17,27 +17,26 @@
*/
package org.apache.hadoop.hbase.http;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.net.HttpURLConnection;
+import java.util.concurrent.TimeUnit;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.annotations.ContextEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.annotations.CreatePartition;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
/**
* Test class for LDAP authentication on the HttpServer.
*/
-@Category({ MiscTests.class, SmallTests.class })
+@Tag("org.apache.hadoop.hbase.testclassification.MiscTests")
+@Tag("org.apache.hadoop.hbase.testclassification.SmallTests")
@CreateLdapServer(
transports = { @CreateTransport(protocol = "LDAP", address =
LdapConstants.LDAP_SERVER_ADDR), })
@CreateDS(name = "TestLdapHttpServer", allowAnonAccess = true,
@@ -46,12 +45,9 @@ import org.junit.experimental.categories.Category;
+ "dc: example\n" + "objectClass: top\n" + "objectClass:
domain\n\n")) })
@ApplyLdifs({ "dn: uid=bjones," + LdapConstants.LDAP_BASE_DN, "cn: Bob Jones",
"sn: Jones",
"objectClass: inetOrgPerson", "uid: bjones", "userPassword: p@ssw0rd" })
+@Timeout(value = 1, unit = TimeUnit.MINUTES)
public class TestLdapHttpServer extends LdapServerTestBase {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestLdapHttpServer.class);
-
private static final String BJONES_CREDENTIALS = "bjones:p@ssw0rd";
private static final String WRONG_CREDENTIALS = "bjones:password";
diff --git a/pom.xml b/pom.xml
index 0ca4f418742..67bf69fa0a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -790,8 +790,8 @@
<vega-embed.version>6.29.0</vega-embed.version>
<vega-lite.version>5.23.0</vega-lite.version>
<!-- Required for testing LDAP integration -->
- <apacheds.version>2.0.0.AM26</apacheds.version>
- <ldap-api.version>2.0.0</ldap-api.version>
+ <apacheds.version>2.0.0.AM27</apacheds.version>
+ <ldap-api.version>2.1.7</ldap-api.version>
</properties>
<!-- Sorted by groups of dependencies then groupId and artifactId -->
<dependencyManagement>