From 994608549dcd7902d2730435d3cc8f8c8f69fd8b Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Wed, 28 Mar 2012 15:13:00 +0000
Subject: [PATCH] Fix test to avoid creating new context on authentication (waste of resources).
---
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SASLOverTLSTestCase.java | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SASLOverTLSTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SASLOverTLSTestCase.java
index 1a326dd..fb26a80 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SASLOverTLSTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SASLOverTLSTestCase.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2012 ForgeRock AS.
*/
package org.opends.server.extensions;
@@ -259,7 +259,7 @@
objectClass.add("person");
objectClass.add("organizationalPerson");
objectClass.add("inetOrgPerson");
- Attribute pwdPolicy =
+ Attribute aPwdPolicy =
new BasicAttribute("ds-pwp-password-policy-dn",pwdPolicyDN);
Attribute cn = new BasicAttribute("cn", "test");
cn.add("test.User");
@@ -268,7 +268,7 @@
entryAttrs.put(objectClass);
entryAttrs.put(cn);
entryAttrs.put(sn);
- entryAttrs.put(pwdPolicy);
+ entryAttrs.put(aPwdPolicy);
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, factory);
String url = "ldaps://localhost:" + TestCaseUtils.getServerLdapsPort();
@@ -277,7 +277,7 @@
env.put(Context.SECURITY_CREDENTIALS, "password");
env.put(Context.SECURITY_AUTHENTICATION, simple);
ctx = new InitialDirContext(env);
- ctx.createSubcontext(testUserDN, entryAttrs);
+ ctx.bind(testUserDN, null, entryAttrs);
ModificationItem[] mods = new ModificationItem[1];
Attribute pwd = new BasicAttribute("userPassword", "password");
mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, pwd);
@@ -331,6 +331,7 @@
* Returns trues, accepting any host name.
*/
class SampleVerifier implements HostnameVerifier {
+ @Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
--
Gitblit v1.10.0