From 7a6a343922a8e1c06e01da8b41ebc1a5fa97dd0e Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 08 Oct 2013 16:30:23 +0000
Subject: [PATCH] OPENDJ-346 Consider using java.util.ServiceLoader for loading extensions and requesting transport implementations

---
 /dev/null                                                                                                 |   47 -----------------------
 opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java |   20 ++++-----
 2 files changed, 9 insertions(+), 58 deletions(-)

diff --git a/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java b/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java
index 96146a3..9660651 100644
--- a/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java
+++ b/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java
@@ -79,7 +79,6 @@
 import org.testng.annotations.Test;
 
 import static org.forgerock.opendj.adapter.server2x.EmbeddedServerTestCaseUtils.CONFIG_PROPERTIES;
-import static org.forgerock.opendj.adapter.server2x.TestCaseUtils.getLDAPTestOptions;
 
 /**
  * This class defines a set of tests for the Adapters.class.
@@ -96,8 +95,8 @@
     @DataProvider
     public Object[][] anonymousConnectionFactories() {
         return new Object[][] {
-            { new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")),
-                        getLDAPTestOptions()) },
+            { new LDAPConnectionFactory("localhost",
+                    Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))) },
             { Adapters.newAnonymousConnectionFactory() } };
     }
 
@@ -111,8 +110,7 @@
         return new Object[][] {
             { Connections.newAuthenticatedConnectionFactory(
                    new LDAPConnectionFactory("localhost",
-                           Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")),
-                           getLDAPTestOptions()),
+                           Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))),
                    Requests.newSimpleBindRequest("cn=directory manager", "password".toCharArray())) },
             { Adapters.newConnectionFactoryForUser(DN.valueOf("cn=directory manager")) } };
     }
@@ -218,8 +216,8 @@
     @Test()
     public void testSimpleLDAPConnectionFactorySimpleBind() throws ErrorResultException {
         final LDAPConnectionFactory factory =
-                new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES
-                        .getProperty("listen-port")), getLDAPTestOptions());
+                new LDAPConnectionFactory("localhost",
+                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
         Connection connection = null;
         try {
             connection = factory.getConnection();
@@ -244,8 +242,8 @@
     public void testLDAPSASLBind() throws NumberFormatException, GeneralSecurityException,
             ErrorResultException {
         LDAPConnectionFactory factory =
-                new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES
-                        .getProperty("listen-port")), getLDAPTestOptions());
+                new LDAPConnectionFactory("localhost",
+                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
 
         Connection connection = factory.getConnection();
         PlainSASLBindRequest request =
@@ -1022,8 +1020,8 @@
 
         // LDAP Connection
         final LDAPConnectionFactory factory =
-                new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES
-                        .getProperty("listen-port")), getLDAPTestOptions());
+                new LDAPConnectionFactory("localhost",
+                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
         Connection connection = null;
         connection = factory.getConnection();
         connection.bind("cn=Directory Manager", "password".toCharArray());
diff --git a/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/TestCaseUtils.java b/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/TestCaseUtils.java
deleted file mode 100644
index e1aaf26..0000000
--- a/opendj3/opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/TestCaseUtils.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2013 ForgeRock AS.
- */
-
-package org.forgerock.opendj.adapter.server2x;
-
-import org.forgerock.opendj.ldap.LDAPOptions;
-
-/**
- * This class defines some utility functions which can be used by test cases.
- */
-public final class TestCaseUtils {
-
-    /**
-     * 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());
-    }
-
-}

--
Gitblit v1.10.0