From d0ce1d7f63e37dc3dc2233b52ced614a2cb5d71b Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Wed, 30 Sep 2026 10:57:11 +0000
Subject: [PATCH] [#1116] Default the java-class of a new LDAP connection handler to LDAPConnectionHandler2 (#1124)
---
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
index 5d16745..9aa744a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
@@ -29,6 +29,7 @@
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.server.LDAPConnectionHandlerCfg;
import org.opends.server.api.ClientConnection;
+import org.opends.server.api.ConnectionHandler;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
@@ -366,4 +367,38 @@
LDAPConnHandler.applyConfigurationChange(config);
LDAPConnHandler.finalizeConnectionHandler(reasonMsg);
}
+
+ /**
+ * A handler created with {@code dsconfig create-connection-handler --type ldap} and no explicit
+ * {@code java-class} must run on the same class as the shipped LDAP listeners, not on the legacy
+ * {@link LDAPConnectionHandler} (issue #1116).
+ */
+ @Test
+ public void testCreatedHandlerDefaultsToLDAPConnectionHandler2() throws Exception {
+ final String handlerName = "Default Class LDAP Connection Handler";
+ final DN handlerDN = DN.valueOf("cn=" + handlerName + ",cn=Connection Handlers,cn=config");
+ TestCaseUtils.dsconfig(
+ "create-connection-handler",
+ "--type", "ldap",
+ "--handler-name", handlerName,
+ "--set", "enabled:true",
+ "--set", "listen-address:127.0.0.1",
+ "--set", "listen-port:" + TestCaseUtils.findFreePort());
+ try {
+ Entry handlerEntry = DirectoryServer.getEntry(handlerDN);
+ assertEquals(handlerEntry.parseAttribute("ds-cfg-java-class").asString(),
+ LDAPConnectionHandler2.class.getName());
+
+ ConnectionHandler<?> running = null;
+ for (ConnectionHandler<?> handler : DirectoryServer.getConnectionHandlers()) {
+ if (handlerDN.equals(handler.getComponentEntryDN())) {
+ running = handler;
+ }
+ }
+ assertNotNull(running, "the created handler is not registered");
+ assertEquals(running.getClass(), LDAPConnectionHandler2.class);
+ } finally {
+ TestCaseUtils.dsconfig("delete-connection-handler", "--handler-name", handlerName);
+ }
+ }
}
--
Gitblit v1.10.0