From f2090c0d863b07e3bad8d16a3efddfad6ff77960 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 08 Oct 2013 14:16:54 +0000
Subject: [PATCH] Fix OPENDJ-346 Consider using java.util.ServiceLoader for loading extensions and requesting transport implementations This a a part of OPENDJ-175 - Decouple OpenDJ LDAP SDK from Grizzly  CR-2440

---
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
index 2a8c3bd..17bd937 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
@@ -222,4 +222,26 @@
         }
         return mock;
     }
+
+    /**
+     * Returns LDAP options with the parameter {@code LDAPOptions#getClassLoader()} already
+     * set to the test class loader.
+     *
+     * @return LDAPOptions already set with the class loader used by the test.
+     *         This is required if the test need to use a transport provider.
+     */
+    public static LDAPOptions getLDAPTestOptions() {
+        return new LDAPOptions().setProviderClassLoader(Thread.currentThread().getContextClassLoader());
+    }
+
+    /**
+     * Returns LDAPListener options with the parameter {@code LDAPListenerOptions#getClassLoader()} already
+     * set to the test class loader.
+     *
+     * @return LDAPListenerOptions already set with the class loader used by the test.
+     *         This is required if the test need to use a transport provider.
+     */
+    public static LDAPListenerOptions getLDAPListenerTestOptions() {
+        return new LDAPListenerOptions().setProviderClassLoader(Thread.currentThread().getContextClassLoader());
+    }
 }

--
Gitblit v1.10.0