[prev in list] [next in list] [prev in thread] [next in thread] 

List:       forgerock-openicf-commit
Subject:    [Commitopenicf] [6874] tags: Tag openicf-ldap-connector-1.4.1.0-RC3
From:       anonymous () forgerock ! org
Date:       2015-09-11 13:00:13
Message-ID: 20150911130013.4C1E940926 () sources ! internal ! forgerock ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[6874] tags: Tag openicf-ldap-connector-1.4.1.0-RC3</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://sources.forgerock.org/changelog/openicf/?cs=6874">6874</a></dd> \
<dt>Author</dt> <dd>Laszlo</dd> <dt>Date</dt> <dd>2015-09-11 14:00:13 +0100 (Fri, 11 \
Sep 2015)</dd> </dl>

<h3>Log Message</h3>
<pre>Tag openicf-ldap-connector-1.4.1.0-RC3</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsopenicfldapconnector1410RC3pomxml">tags/openicf-ldap-connector-1.4.1.0-RC3/pom.xml</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/opends/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/src/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/</li>
 <li><a href="#tagsopenicfldapconnector1410RC3srcmainjavaorgidentityconnectorsldapsync \
timestampsTimestampsSyncStrategyjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/main \
/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestconfigorgidentityconnectorsldapLd \
apConnectorconfigconfiggroovy">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAdap \
terCompatibilityTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAppe \
ndingAttributesTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
AuthenticateTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
ConfigurationTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
ConnectionTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
ConnectorTestBasejava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
EntryTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapSunD \
STestBasejava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodi \
fyLdapCreateTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodi \
fyLdapDeleteTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodi \
fyLdapUpdateTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsche \
maGuardedPasswordAttributeTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/ \
java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java</a></li> \
<li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapschem \
aLdapSchemaMappingTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsear \
chLdapFilterTranslatorTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsear \
chLdapSearchTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsync \
sundsLdapModifyForTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsync \
sundsLdifParserTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsync \
sundsSunDSChangeLogSyncStrategyTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/ \
test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java</a></li>
 </ul>

<h3>Removed Paths</h3>
<ul>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/opends/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/src/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/</li>
<li>tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/</li>
 <li><a href="#tagsopenicfldapconnector1410RC3srcmainjavaorgidentityconnectorsldapsync \
timestampsTimestampsSyncStrategyjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/main \
/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestconfigorgidentityconnectorsldapLd \
apConnectorconfigconfiggroovy">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAdap \
terCompatibilityTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAppe \
ndingAttributesTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
AuthenticateTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
ConfigurationTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
ConnectionTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
ConnectorTestBasejava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdap \
EntryTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapSunD \
STestBasejava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodi \
fyLdapCreateTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodi \
fyLdapDeleteTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodi \
fyLdapUpdateTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsche \
maGuardedPasswordAttributeTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/ \
java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java</a></li> \
<li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapschem \
aLdapSchemaMappingTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsear \
chLdapFilterTranslatorTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsear \
chLdapSearchTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsync \
sundsLdapModifyForTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsync \
sundsLdifParserTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java</a></li>
 <li><a href="#tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsync \
sundsSunDSChangeLogSyncStrategyTestsjava">tags/openicf-ldap-connector-1.4.1.0-RC3/src/ \
test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsopenicfldapconnector1410RC3pomxml"></a>
<div class="modfile"><h4>Modified: tags/openicf-ldap-connector-1.4.1.0-RC3/pom.xml \
(6872 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- branches/openicf-ldap-connector-1.4.1.x/pom.xml	2015-09-11 \
                09:53:21 UTC (rev 6872)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/pom.xml	2015-09-11 13:00:13 UTC (rev \
6874) </span><span class="lines">@@ -32,15 +32,15 @@
</span><span class="cx">     &lt;/parent&gt;
</span><span class="cx">     \
&lt;groupId&gt;org.forgerock.openicf.connectors&lt;/groupId&gt; </span><span \
class="cx">     &lt;artifactId&gt;ldap-connector&lt;/artifactId&gt; </span><del>-    \
&lt;version&gt;1.4.1.1-SNAPSHOT&lt;/version&gt; </del><ins>+    \
&lt;version&gt;1.4.1.0-RC3&lt;/version&gt; </ins><span class="cx">     \
&lt;packaging&gt;bundle&lt;/packaging&gt; </span><span class="cx">     \
&lt;name&gt;Generic JNDI based LDAP Connector&lt;/name&gt; </span><span class="cx">   \
&lt;description&gt;Connector for Sun DSEE and OpenDJ and Generic \
LDAP&lt;/description&gt; </span><span class="cx">     \
&lt;url&gt;http://openicf.forgerock.org/connectors/ldap-connector&lt;/url&gt; \
</span><span class="cx">     &lt;scm&gt; </span><del>-        \
&lt;connection&gt;scm:svn:https://svn.forgerock.org/openicf/branches/openicf-ldap-connector-1.4.1.x&lt;/connection&gt;
                
-        &lt;developerConnection&gt;scm:svn:https://svn.forgerock.org/openicf/branches/openicf-ldap-connector-1.4.1.x&lt;/developerConnection&gt;
                
-        &lt;url&gt;http://sources.forgerock.org/browse/openicf/branches/openicf-ldap-connector-1.4.1.x&lt;/url&gt;
 </del><ins>+        \
&lt;connection&gt;scm:svn:https://svn.forgerock.org/openicf/tags/openicf-ldap-connector-1.4.1.0-RC3&lt;/connection&gt;
 +        &lt;developerConnection&gt;scm:svn:https://svn.forgerock.org/openicf/tags/openicf-ldap-connector-1.4.1.0-RC3&lt;/developerConnection&gt;
 +        &lt;url&gt;http://sources.forgerock.org/browse/openicf/tags/openicf-ldap-connector-1.4.1.0-RC3&lt;/url&gt;
 </ins><span class="cx">     &lt;/scm&gt;
</span><span class="cx">     &lt;issueManagement&gt;
</span><span class="cx">         &lt;system&gt;jira&lt;/system&gt;
</span></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srcmainjavaorgidentityconnectorsldapsynctimestampsTimestampsSyncStrategyjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,323 +0,0 @@
</span><del>-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2015 ForgeRock AS. All Rights Reserved
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the License). You may not use this file except in
- * compliance with the License.
- *
- * You can obtain a copy of the License at
- * http://forgerock.org/license/CDDLv1.0.html
- * See the License for the specific language governing
- * permission and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * Header Notice in each file and include the License file
- * at http://forgerock.org/license/CDDLv1.0.html
- * If applicable, add the following below the CDDL Header,
- * with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- */
-package org.identityconnectors.ldap.sync.timestamps;
-
-import static org.identityconnectors.ldap.ADLdapUtil.fetchGroupMembersByRange;
-import static org.identityconnectors.ldap.ADLdapUtil.objectGUIDtoString;
-import static org.identityconnectors.ldap.LdapUtil.buildMemberIdAttribute;
-import static org.identityconnectors.ldap.LdapConstants.OBJECTCLASS_ATTR;
-import static org.identityconnectors.ldap.LdapUtil.getObjectClassFilter;
-import static org.identityconnectors.ldap.LdapUtil.guessObjectClass;
-
-import java.text.SimpleDateFormat;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.TimeZone;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.PartialResultException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.PagedResultsControl;
-
-import org.identityconnectors.common.logging.Log;
-import org.identityconnectors.framework.common.exceptions.ConnectorException;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.ConnectorObjectBuilder;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.SyncDeltaBuilder;
-import org.identityconnectors.framework.common.objects.SyncDeltaType;
-import org.identityconnectors.framework.common.objects.SyncResultsHandler;
-import org.identityconnectors.framework.common.objects.SyncToken;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.identityconnectors.framework.spi.SyncTokenResultsHandler;
-import org.identityconnectors.ldap.ADGroupType;
-import org.identityconnectors.ldap.ADLdapUtil;
-import org.identityconnectors.ldap.ADUserAccountControl;
-import org.identityconnectors.ldap.LdapConnection;
-import org.identityconnectors.ldap.LdapConstants.ServerType;
-import org.identityconnectors.ldap.LdapConstants;
-import org.identityconnectors.ldap.LdapEntry;
-import org.identityconnectors.ldap.search.DefaultSearchStrategy;
-import org.identityconnectors.ldap.search.LdapInternalSearch;
-import org.identityconnectors.ldap.search.LdapSearchStrategy;
-import org.identityconnectors.ldap.search.LdapSearchResultsHandler;
-import org.identityconnectors.ldap.search.SimplePagedSearchStrategy;
-import org.identityconnectors.ldap.sync.LdapSyncStrategy;
-
-/**
- * An implementation of the sync operation based on the generic timestamps
- * attribute present in any LDAP directory.
- */
-public class TimestampsSyncStrategy implements LdapSyncStrategy {
-
-    private final String createTimestamp = &quot;createTimestamp&quot;;
-    private final String modifyTimestamp = &quot;modifyTimestamp&quot;;
-    private final LdapConnection conn;
-    private final ObjectClass oclass;
-    private final ServerType server;
-    private static final Log logger = Log.getLog(TimestampsSyncStrategy.class);
-
-    public TimestampsSyncStrategy(LdapConnection conn, ObjectClass oclass) {
-        this.conn = conn;
-        this.oclass = oclass;
-        this.server = conn.getServerType();
-    }
-
-    public SyncToken getLatestSyncToken() {
-        return new SyncToken(getNowTime());
-    }
-
-    public void sync(SyncToken token, final SyncResultsHandler handler, final \
                OperationOptions options) {
-        // ldapsearch -h host -p 389 -b &quot;dc=example,dc=com&quot; -D \
&quot;cn=administrator,cn=users,dc=example,dc=com&quot; -w xxx \
                &quot;whenchanged&gt;=20130214130642.0Z&quot;
-        // on AD
-        // ldapsearch -h host -p 389 -b 'dc=example,dc=com' -S modifytimestamp -D \
                'cn=directory manager' -w xxx \
                &quot;createTimestamp&gt;=20120424080554Z&quot;
-        // on other directories
-
-        final String now = getNowTime();
-        LdapSearchStrategy strategy;
-        SearchControls controls = LdapInternalSearch.createDefaultSearchControls();
-        controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-        controls.setDerefLinkFlag(false);
-        if (ADLdapUtil.isServerMSADFamily(server)) {
-            controls.setReturningAttributes(getAttributesToGet(new \
                String[]{createTimestamp, modifyTimestamp,
-                ADUserAccountControl.MSDS_USR_ACCT_CTRL_ATTR,
-                conn.getConfiguration().getUidAttribute()}, \
                options.getAttributesToGet()));
-        } else {
-            controls.setReturningAttributes(getAttributesToGet(new \
                String[]{createTimestamp, modifyTimestamp,
-                conn.getConfiguration().getUidAttribute()}, \
                options.getAttributesToGet()));
-        }
-
-        if (conn.getConfiguration().isUseBlocks() &amp;&amp; \
                conn.supportsControl(PagedResultsControl.OID)) {
-            strategy = new \
                SimplePagedSearchStrategy(conn.getConfiguration().getBlockSize());
-        } else {
-            strategy = new DefaultSearchStrategy(false);
-        }
-
-        LdapInternalSearch search = new LdapInternalSearch(conn,
-                generateFilter(oclass, token),
-                Arrays.asList(conn.getConfiguration().getBaseContextsToSynchronize()),
                
-                strategy, controls);
-
-        try {
-            search.execute(new LdapSearchResultsHandler() {
-                public boolean handle(String baseDN, SearchResult result) throws \
                NamingException {
-                    LdapEntry entry = LdapEntry.create(baseDN, result);
-                    Attributes attrs = result.getAttributes();
-                    Uid uid = conn.getSchemaMapping().createUid(oclass, entry);
-                    // build the object first
-                    ConnectorObjectBuilder cob = new ConnectorObjectBuilder();
-                    cob.setUid(uid);
-                    if (ObjectClass.ALL.equals(oclass)) {
-                        cob.setObjectClass(guessObjectClass(conn, \
                attrs.get(OBJECTCLASS_ATTR)));
-                    } else {
-                        cob.setObjectClass(oclass);
-                    }
-                    cob.setName(result.getNameInNamespace());
-
-                    // Let's process AD specifics...
-                    if (ADLdapUtil.isServerMSADFamily(server)) {
-                        if (ObjectClass.ACCOUNT.equals(oclass)) {
-                            if (ServerType.MSAD_LDS.equals(server)) {
-                                if \
                (attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_DISABLED) != null) {
-                                    \
cob.addAttribute(AttributeBuilder.buildEnabled(!Boolean.parseBoolean(attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_DISABLED).get().toString())));
                
-                                } else if \
                (attrs.get(LdapConstants.MS_DS_USER_PASSWORD_EXPIRED) != null) {
-                                    \
cob.addAttribute(AttributeBuilder.buildPasswordExpired(Boolean.parseBoolean(attrs.get(LdapConstants.MS_DS_USER_PASSWORD_EXPIRED).get().toString())));
                
-                                } else if \
                (attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_AUTOLOCKED) != null) {
-                                    \
cob.addAttribute(AttributeBuilder.buildLockOut(Boolean.parseBoolean(attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_AUTOLOCKED).get().toString())));
                
-                                }
-                            } else {
-                                if \
                (attrs.get(ADUserAccountControl.MS_USR_ACCT_CTRL_ATTR) != null) {
-                                    String uac = \
                attrs.get(ADUserAccountControl.MS_USR_ACCT_CTRL_ATTR).get().toString();
                
-                                    \
cob.addAttribute(AttributeBuilder.buildEnabled(!ADUserAccountControl.isAccountDisabled(uac)));
                
-                                    \
cob.addAttribute(AttributeBuilder.build(ADUserAccountControl.DONT_EXPIRE_PASSWORD_NAME, \
                ADUserAccountControl.isDontExpirePassword(uac)));
-                                    \
cob.addAttribute(AttributeBuilder.build(ADUserAccountControl.PASSWORD_NOTREQD_NAME, \
                ADUserAccountControl.isPasswordNotReq(uac)));
-                                    \
cob.addAttribute(AttributeBuilder.build(ADUserAccountControl.SMARTCARD_REQUIRED_NAME, \
                ADUserAccountControl.isSmartCardRequired(uac)));
-                                }
-                                if \
                (attrs.get(ADUserAccountControl.MSDS_USR_ACCT_CTRL_ATTR) != null) {
-                                    String uac2 = \
                attrs.get(ADUserAccountControl.MSDS_USR_ACCT_CTRL_ATTR).get().toString();
                
-                                    \
cob.addAttribute(AttributeBuilder.buildLockOut(ADUserAccountControl.isAccountLockOut(uac2)));
                
-                                    \
cob.addAttribute(AttributeBuilder.buildPasswordExpired(ADUserAccountControl.isPasswordExpired(uac2)));
                
-                                }
-                            }
-                            if (attrs.get(ADUserAccountControl.ACCOUNT_EXPIRES) != \
                null) {
-                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.ACCOUNT_EXPIRES)));
                
-                                attrs.remove(ADUserAccountControl.ACCOUNT_EXPIRES);
-                            }
-                            if (attrs.get(ADUserAccountControl.PWD_LAST_SET) != \
                null) {
-                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.PWD_LAST_SET)));
                
-                                attrs.remove(ADUserAccountControl.PWD_LAST_SET);
-                            }
-                            if (attrs.get(ADUserAccountControl.LAST_LOGON) != null) \
                {
-                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.LAST_LOGON)));
                
-                                attrs.remove(ADUserAccountControl.LAST_LOGON);
-                            }
-                            if (attrs.get(ADUserAccountControl.LOCKOUT_TIME) != \
                null) {
-                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.LOCKOUT_TIME)));
                
-                                attrs.remove(ADUserAccountControl.LOCKOUT_TIME);
-                            }
-                        }
-                        if (ObjectClass.GROUP.equals(oclass)) {
-                            // Make sure we're not hitting AD large group issue
-                            // see: \
                http://msdn.microsoft.com/en-us/library/ms817827.aspx
-                            if (attrs.get(&quot;member;range=0-1499&quot;) != null) \
                {
-                                // we're in the limitation
-                                Attribute range = \
                AttributeBuilder.build(&quot;member&quot;, \
                fetchGroupMembersByRange(conn, result));
-                                cob.addAttribute(range);
-                                if (conn.getConfiguration().isGetGroupMemberId()) {
-                                    cob.addAttribute(buildMemberIdAttribute(conn, \
                range));
-                                }
-                                attrs.remove(&quot;member;range=0-1499&quot;);
-                                attrs.remove(&quot;member&quot;);
-                            }
-                            try {
-                                if (attrs.get(ADGroupType.GROUPTYPE) != null) {
-                                    String groupType = \
                attrs.get(ADGroupType.GROUPTYPE).get().toString();
-                                    \
cob.addAttribute(AttributeBuilder.build(ADGroupType.GROUP_SCOPE_NAME, \
                ADGroupType.getScope(groupType)));
-                                    \
cob.addAttribute(AttributeBuilder.build(ADGroupType.GROUP_TYPE_NAME, \
                ADGroupType.getType(groupType)));
-                                }
-                            } catch (NamingException e) {
-                                logger.warn(e, &quot;Can't read groupType attribute: \
                &quot; + e.getExplanation());
-                            }
-                        }
-                        javax.naming.directory.Attribute guid = \
                attrs.get(LdapConstants.MS_GUID_ATTR);
-                        if (guid != null) {
-                            \
cob.addAttribute(AttributeBuilder.build(LdapConstants.MS_GUID_ATTR, \
                objectGUIDtoString(guid)));
-                            attrs.remove(LdapConstants.MS_GUID_ATTR);
-                        }
-                    }
-                    // Set all Attributes
-                    NamingEnumeration&lt;? extends \
                javax.naming.directory.Attribute&gt; attrsEnum = attrs.getAll();
-                    while (attrsEnum.hasMore()) {
-                        javax.naming.directory.Attribute attr = attrsEnum.next();
-                        String id = attr.getID();
-                        NamingEnumeration vals = attr.getAll();
-                        ArrayList values = new ArrayList();
-                        while (vals.hasMore()) {
-                            values.add(vals.next());
-                        }
-                        if (conn.getConfiguration().isGetGroupMemberId() &amp;&amp; \
                ObjectClass.GROUP.equals(oclass)
-                                &amp;&amp; \
                id.equalsIgnoreCase(conn.getConfiguration().getGroupMemberAttribute())) \
                {
-                            cob.addAttribute(buildMemberIdAttribute(conn, attr));
-                        }
-                        cob.addAttribute(AttributeBuilder.build(id, values));
-                    }
-
-                    SyncDeltaBuilder syncDeltaBuilder = new SyncDeltaBuilder();
-                    syncDeltaBuilder.setToken(new SyncToken(now));
-                    syncDeltaBuilder.setDeltaType(SyncDeltaType.CREATE_OR_UPDATE);
-                    syncDeltaBuilder.setUid(uid);
-                    syncDeltaBuilder.setObject(cob.build());
-
-                    return handler.handle(syncDeltaBuilder.build());
-                }
-            });
-            // ICF 1.4 now allows us to send the Token even if no entries were \
                actually processed
-            ((SyncTokenResultsHandler) handler).handleResult(new SyncToken(now));
-        } catch (ConnectorException e) {
-            if (e.getCause() instanceof PartialResultException) {
-                logger.warn(&quot;PartialResultException has been caught&quot;);
-            } else {
-                throw e;
-            }
-        }
-    }
-
-    @SuppressWarnings(&quot;fallthrough&quot;)
-    private String getNowTime() {
-        SimpleDateFormat sdf = new SimpleDateFormat(&quot;yyyyMMddHHmmss&quot;);
-        sdf.setTimeZone(TimeZone.getTimeZone(&quot;GMT&quot;));
-
-        switch (server) {
-            case MSAD_GC:
-            case MSAD:
-            case MSAD_LDS:
-                return sdf.format(new Date()) + &quot;.0Z&quot;;
-            default:
-                return sdf.format(new Date()) + &quot;Z&quot;;
-        }
-    }
-
-    private String generateFilter(ObjectClass oc, SyncToken token) {
-        StringBuilder filter;
-        filter = new StringBuilder();
-
-        if (token == null) {
-            token = this.getLatestSyncToken();
-        }
-        if (ObjectClass.ACCOUNT.equals(oc)) {
-            filter.append(getObjectClassFilter(conn.getConfiguration().getAccountObjectClasses()));
                
-            if (conn.getConfiguration().getAccountSynchronizationFilter() != null) {
-                filter.append(conn.getConfiguration().getAccountSynchronizationFilter());
                
-            }
-        } else if (ObjectClass.GROUP.equals(oc)) {
-            filter.append(getObjectClassFilter(conn.getConfiguration().getGroupObjectClasses()));
                
-            if (conn.getConfiguration().getGroupSynchronizationFilter() != null) {
-                filter.append(conn.getConfiguration().getGroupSynchronizationFilter());
                
-            }
-        } else if (ObjectClass.ALL.equals(oc)) {
-            filter.append(getObjectClassFilter(conn.getConfiguration().getObjectClassesToSynchronize()));
                
-        } else { // we use the ObjectClass value as the filter...
-            filter.append(&quot;(objectClass=&quot;);
-            filter.append(oc.getObjectClassValue());
-            filter.append(&quot;)&quot;);
-        }
-
-        filter.append(&quot;(|(&quot;);
-        filter.append(modifyTimestamp);
-        filter.append(&quot;&gt;=&quot;);
-        filter.append(token.getValue().toString());
-        filter.append(&quot;)(&quot;);
-        filter.append(createTimestamp);
-        filter.append(&quot;&gt;=&quot;);
-        filter.append(token.getValue().toString());
-        filter.append(&quot;))&quot;);
-        filter.insert(0, &quot;(&amp;&quot;);
-        filter.append(&quot;)&quot;);
-        logger.info(&quot;Using timestamp filter {0}&quot;, filter.toString());
-        return filter.toString();
-    }
-    
-    static String[] getAttributesToGet(String[]... attrsLists) {
-    int len = 0;
-    for (String[] attrs : attrsLists) {
-        len += attrs.length;
-    }
-    String[] attrsToGet = new String[len];
-    int idx = 0;
-    for (String[] attrs : attrsLists) {
-        for (String attr : attrs) {
-            attrsToGet[idx] = attr;
-            idx++;
-        }
-    }
-    return attrsToGet;
-}
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srcmainjavaorgidentityconnectorsldapsynctimestam \
psTimestampsSyncStrategyjavafromrev6872branchesopenicfldapconnector141xsrcmainjavaorgidentityconnectorsldapsynctimestampsTimestampsSyncStrategyjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/main/java/org/identityconnectors/ldap/sync/timestamps/TimestampsSyncStrategy.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,328 @@
</span><ins>+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013-2015 ForgeRock AS. All Rights Reserved
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ */
+package org.identityconnectors.ldap.sync.timestamps;
+
+import static org.identityconnectors.ldap.ADLdapUtil.fetchGroupMembersByRange;
+import static org.identityconnectors.ldap.ADLdapUtil.objectGUIDtoString;
+import static org.identityconnectors.ldap.LdapUtil.buildMemberIdAttribute;
+import static org.identityconnectors.ldap.LdapConstants.OBJECTCLASS_ATTR;
+import static org.identityconnectors.ldap.LdapUtil.getObjectClassFilter;
+import static org.identityconnectors.ldap.LdapUtil.guessObjectClass;
+
+import java.text.SimpleDateFormat;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.TimeZone;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.PartialResultException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.PagedResultsControl;
+
+import org.identityconnectors.common.logging.Log;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.ConnectorObjectBuilder;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.SyncDeltaBuilder;
+import org.identityconnectors.framework.common.objects.SyncDeltaType;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
+import org.identityconnectors.framework.common.objects.SyncToken;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.identityconnectors.framework.spi.SyncTokenResultsHandler;
+import org.identityconnectors.ldap.ADGroupType;
+import org.identityconnectors.ldap.ADLdapUtil;
+import org.identityconnectors.ldap.ADUserAccountControl;
+import org.identityconnectors.ldap.LdapConnection;
+import org.identityconnectors.ldap.LdapConstants.ServerType;
+import org.identityconnectors.ldap.LdapConstants;
+import org.identityconnectors.ldap.LdapEntry;
+import org.identityconnectors.ldap.search.DefaultSearchStrategy;
+import org.identityconnectors.ldap.search.LdapInternalSearch;
+import org.identityconnectors.ldap.search.LdapSearchStrategy;
+import org.identityconnectors.ldap.search.LdapSearchResultsHandler;
+import org.identityconnectors.ldap.search.SimplePagedSearchStrategy;
+import org.identityconnectors.ldap.sync.LdapSyncStrategy;
+
+/**
+ * An implementation of the sync operation based on the generic timestamps
+ * attribute present in any LDAP directory.
+ */
+public class TimestampsSyncStrategy implements LdapSyncStrategy {
+
+    private final String createTimestamp = &quot;createTimestamp&quot;;
+    private final String modifyTimestamp = &quot;modifyTimestamp&quot;;
+    private final LdapConnection conn;
+    private final ObjectClass oclass;
+    private final ServerType server;
+    private static final Log logger = Log.getLog(TimestampsSyncStrategy.class);
+
+    public TimestampsSyncStrategy(LdapConnection conn, ObjectClass oclass) {
+        this.conn = conn;
+        this.oclass = oclass;
+        this.server = conn.getServerType();
+    }
+
+    public SyncToken getLatestSyncToken() {
+        return new SyncToken(getNowTime());
+    }
+
+    public void sync(SyncToken token, final SyncResultsHandler handler, final \
OperationOptions options) { +        // ldapsearch -h host -p 389 -b \
&quot;dc=example,dc=com&quot; -D \
&quot;cn=administrator,cn=users,dc=example,dc=com&quot; -w xxx \
&quot;whenchanged&gt;=20130214130642.0Z&quot; +        // on AD
+        // ldapsearch -h host -p 389 -b 'dc=example,dc=com' -S modifytimestamp -D \
'cn=directory manager' -w xxx &quot;createTimestamp&gt;=20120424080554Z&quot; +       \
// on other directories +
+        final String now = getNowTime();
+        LdapSearchStrategy strategy;
+        String[] attrsToGet = new String[]{&quot;*&quot;};
+        SearchControls controls = LdapInternalSearch.createDefaultSearchControls();
+        controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+        controls.setDerefLinkFlag(false);
+        
+        if (null != options.getAttributesToGet() &amp;&amp; \
options.getAttributesToGet().length != 0){ +            attrsToGet = \
options.getAttributesToGet(); +        }
+        if (ADLdapUtil.isServerMSADFamily(server)) {
+            controls.setReturningAttributes(getAttributesToGet(new \
String[]{createTimestamp, modifyTimestamp, +                \
ADUserAccountControl.MSDS_USR_ACCT_CTRL_ATTR, +                \
conn.getConfiguration().getUidAttribute()}, attrsToGet)); +        } else {
+            controls.setReturningAttributes(getAttributesToGet(new \
String[]{createTimestamp, modifyTimestamp, +                \
conn.getConfiguration().getUidAttribute()}, attrsToGet)); +        }
+
+        if (conn.getConfiguration().isUseBlocks() &amp;&amp; \
conn.supportsControl(PagedResultsControl.OID)) { +            strategy = new \
SimplePagedSearchStrategy(conn.getConfiguration().getBlockSize()); +        } else {
+            strategy = new DefaultSearchStrategy(false);
+        }
+
+        LdapInternalSearch search = new LdapInternalSearch(conn,
+                generateFilter(oclass, token),
+                Arrays.asList(conn.getConfiguration().getBaseContextsToSynchronize()),
 +                strategy, controls);
+
+        try {
+            search.execute(new LdapSearchResultsHandler() {
+                public boolean handle(String baseDN, SearchResult result) throws \
NamingException { +                    LdapEntry entry = LdapEntry.create(baseDN, \
result); +                    Attributes attrs = result.getAttributes();
+                    Uid uid = conn.getSchemaMapping().createUid(oclass, entry);
+                    // build the object first
+                    ConnectorObjectBuilder cob = new ConnectorObjectBuilder();
+                    cob.setUid(uid);
+                    if (ObjectClass.ALL.equals(oclass)) {
+                        cob.setObjectClass(guessObjectClass(conn, \
attrs.get(OBJECTCLASS_ATTR))); +                    } else {
+                        cob.setObjectClass(oclass);
+                    }
+                    cob.setName(result.getNameInNamespace());
+
+                    // Let's process AD specifics...
+                    if (ADLdapUtil.isServerMSADFamily(server)) {
+                        if (ObjectClass.ACCOUNT.equals(oclass)) {
+                            if (ServerType.MSAD_LDS.equals(server)) {
+                                if \
(attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_DISABLED) != null) { +                    \
cob.addAttribute(AttributeBuilder.buildEnabled(!Boolean.parseBoolean(attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_DISABLED).get().toString())));
 +                                } else if \
(attrs.get(LdapConstants.MS_DS_USER_PASSWORD_EXPIRED) != null) { +                    \
cob.addAttribute(AttributeBuilder.buildPasswordExpired(Boolean.parseBoolean(attrs.get(LdapConstants.MS_DS_USER_PASSWORD_EXPIRED).get().toString())));
 +                                } else if \
(attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_AUTOLOCKED) != null) { +                  \
cob.addAttribute(AttributeBuilder.buildLockOut(Boolean.parseBoolean(attrs.get(LdapConstants.MS_DS_USER_ACCOUNT_AUTOLOCKED).get().toString())));
 +                                }
+                            } else {
+                                if \
(attrs.get(ADUserAccountControl.MS_USR_ACCT_CTRL_ATTR) != null) { +                   \
String uac = attrs.get(ADUserAccountControl.MS_USR_ACCT_CTRL_ATTR).get().toString(); \
+                                    \
cob.addAttribute(AttributeBuilder.buildEnabled(!ADUserAccountControl.isAccountDisabled(uac)));
 +                                    \
cob.addAttribute(AttributeBuilder.build(ADUserAccountControl.DONT_EXPIRE_PASSWORD_NAME, \
ADUserAccountControl.isDontExpirePassword(uac))); +                                   \
cob.addAttribute(AttributeBuilder.build(ADUserAccountControl.PASSWORD_NOTREQD_NAME, \
ADUserAccountControl.isPasswordNotReq(uac))); +                                    \
cob.addAttribute(AttributeBuilder.build(ADUserAccountControl.SMARTCARD_REQUIRED_NAME, \
ADUserAccountControl.isSmartCardRequired(uac))); +                                }
+                                if \
(attrs.get(ADUserAccountControl.MSDS_USR_ACCT_CTRL_ATTR) != null) { +                 \
String uac2 = attrs.get(ADUserAccountControl.MSDS_USR_ACCT_CTRL_ATTR).get().toString();
 +                                    \
cob.addAttribute(AttributeBuilder.buildLockOut(ADUserAccountControl.isAccountLockOut(uac2)));
 +                                    \
cob.addAttribute(AttributeBuilder.buildPasswordExpired(ADUserAccountControl.isPasswordExpired(uac2)));
 +                                }
+                            }
+                            if (attrs.get(ADUserAccountControl.ACCOUNT_EXPIRES) != \
null) { +                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.ACCOUNT_EXPIRES)));
 +                                attrs.remove(ADUserAccountControl.ACCOUNT_EXPIRES);
+                            }
+                            if (attrs.get(ADUserAccountControl.PWD_LAST_SET) != \
null) { +                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.PWD_LAST_SET)));
 +                                attrs.remove(ADUserAccountControl.PWD_LAST_SET);
+                            }
+                            if (attrs.get(ADUserAccountControl.LAST_LOGON) != null) \
{ +                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.LAST_LOGON)));
 +                                attrs.remove(ADUserAccountControl.LAST_LOGON);
+                            }
+                            if (attrs.get(ADUserAccountControl.LOCKOUT_TIME) != \
null) { +                                \
cob.addAttribute(ADLdapUtil.convertMSEpochToISO8601(attrs.get(ADUserAccountControl.LOCKOUT_TIME)));
 +                                attrs.remove(ADUserAccountControl.LOCKOUT_TIME);
+                            }
+                        }
+                        if (ObjectClass.GROUP.equals(oclass)) {
+                            // Make sure we're not hitting AD large group issue
+                            // see: \
http://msdn.microsoft.com/en-us/library/ms817827.aspx +                            if \
(attrs.get(&quot;member;range=0-1499&quot;) != null) { +                              \
// we're in the limitation +                                Attribute range = \
AttributeBuilder.build(&quot;member&quot;, fetchGroupMembersByRange(conn, result)); + \
cob.addAttribute(range); +                                if \
(conn.getConfiguration().isGetGroupMemberId()) { +                                    \
cob.addAttribute(buildMemberIdAttribute(conn, range)); +                              \
} +                                attrs.remove(&quot;member;range=0-1499&quot;);
+                                attrs.remove(&quot;member&quot;);
+                            }
+                            try {
+                                if (attrs.get(ADGroupType.GROUPTYPE) != null) {
+                                    String groupType = \
attrs.get(ADGroupType.GROUPTYPE).get().toString(); +                                  \
cob.addAttribute(AttributeBuilder.build(ADGroupType.GROUP_SCOPE_NAME, \
ADGroupType.getScope(groupType))); +                                    \
cob.addAttribute(AttributeBuilder.build(ADGroupType.GROUP_TYPE_NAME, \
ADGroupType.getType(groupType))); +                                }
+                            } catch (NamingException e) {
+                                logger.warn(e, &quot;Can't read groupType attribute: \
&quot; + e.getExplanation()); +                            }
+                        }
+                        javax.naming.directory.Attribute guid = \
attrs.get(LdapConstants.MS_GUID_ATTR); +                        if (guid != null) {
+                            \
cob.addAttribute(AttributeBuilder.build(LdapConstants.MS_GUID_ATTR, \
objectGUIDtoString(guid))); +                            \
attrs.remove(LdapConstants.MS_GUID_ATTR); +                        }
+                    }
+                    // Set all Attributes
+                    NamingEnumeration&lt;? extends \
javax.naming.directory.Attribute&gt; attrsEnum = attrs.getAll(); +                    \
while (attrsEnum.hasMore()) { +                        \
javax.naming.directory.Attribute attr = attrsEnum.next(); +                        \
String id = attr.getID(); +                        NamingEnumeration vals = \
attr.getAll(); +                        ArrayList values = new ArrayList();
+                        while (vals.hasMore()) {
+                            values.add(vals.next());
+                        }
+                        if (conn.getConfiguration().isGetGroupMemberId() &amp;&amp; \
ObjectClass.GROUP.equals(oclass) +                                &amp;&amp; \
id.equalsIgnoreCase(conn.getConfiguration().getGroupMemberAttribute())) { +           \
cob.addAttribute(buildMemberIdAttribute(conn, attr)); +                        }
+                        cob.addAttribute(AttributeBuilder.build(id, values));
+                    }
+
+                    SyncDeltaBuilder syncDeltaBuilder = new SyncDeltaBuilder();
+                    syncDeltaBuilder.setToken(new SyncToken(now));
+                    syncDeltaBuilder.setDeltaType(SyncDeltaType.CREATE_OR_UPDATE);
+                    syncDeltaBuilder.setUid(uid);
+                    syncDeltaBuilder.setObject(cob.build());
+
+                    return handler.handle(syncDeltaBuilder.build());
+                }
+            });
+            // ICF 1.4 now allows us to send the Token even if no entries were \
actually processed +            ((SyncTokenResultsHandler) handler).handleResult(new \
SyncToken(now)); +        } catch (ConnectorException e) {
+            if (e.getCause() instanceof PartialResultException) {
+                logger.warn(&quot;PartialResultException has been caught&quot;);
+            } else {
+                throw e;
+            }
+        }
+    }
+
+    @SuppressWarnings(&quot;fallthrough&quot;)
+    private String getNowTime() {
+        SimpleDateFormat sdf = new SimpleDateFormat(&quot;yyyyMMddHHmmss&quot;);
+        sdf.setTimeZone(TimeZone.getTimeZone(&quot;GMT&quot;));
+
+        switch (server) {
+            case MSAD_GC:
+            case MSAD:
+            case MSAD_LDS:
+                return sdf.format(new Date()) + &quot;.0Z&quot;;
+            default:
+                return sdf.format(new Date()) + &quot;Z&quot;;
+        }
+    }
+
+    private String generateFilter(ObjectClass oc, SyncToken token) {
+        StringBuilder filter;
+        filter = new StringBuilder();
+
+        if (token == null) {
+            token = this.getLatestSyncToken();
+        }
+        if (ObjectClass.ACCOUNT.equals(oc)) {
+            filter.append(getObjectClassFilter(conn.getConfiguration().getAccountObjectClasses()));
 +            if (conn.getConfiguration().getAccountSynchronizationFilter() != null) \
{ +                filter.append(conn.getConfiguration().getAccountSynchronizationFilter());
 +            }
+        } else if (ObjectClass.GROUP.equals(oc)) {
+            filter.append(getObjectClassFilter(conn.getConfiguration().getGroupObjectClasses()));
 +            if (conn.getConfiguration().getGroupSynchronizationFilter() != null) {
+                filter.append(conn.getConfiguration().getGroupSynchronizationFilter());
 +            }
+        } else if (ObjectClass.ALL.equals(oc)) {
+            filter.append(getObjectClassFilter(conn.getConfiguration().getObjectClassesToSynchronize()));
 +        } else { // we use the ObjectClass value as the filter...
+            filter.append(&quot;(objectClass=&quot;);
+            filter.append(oc.getObjectClassValue());
+            filter.append(&quot;)&quot;);
+        }
+
+        filter.append(&quot;(|(&quot;);
+        filter.append(modifyTimestamp);
+        filter.append(&quot;&gt;=&quot;);
+        filter.append(token.getValue().toString());
+        filter.append(&quot;)(&quot;);
+        filter.append(createTimestamp);
+        filter.append(&quot;&gt;=&quot;);
+        filter.append(token.getValue().toString());
+        filter.append(&quot;))&quot;);
+        filter.insert(0, &quot;(&amp;&quot;);
+        filter.append(&quot;)&quot;);
+        logger.info(&quot;Using timestamp filter {0}&quot;, filter.toString());
+        return filter.toString();
+    }
+    
+    static String[] getAttributesToGet(String[]... attrsLists) {
+    int len = 0;
+    for (String[] attrs : attrsLists) {
+        len += attrs.length;
+    }
+    String[] attrsToGet = new String[len];
+    int idx = 0;
+    for (String[] attrs : attrsLists) {
+        for (String attr : attrs) {
+            attrsToGet[idx] = attr;
+            idx++;
+        }
+    }
+    return attrsToGet;
+}
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestconfigorgidentityconnectorsldapLdapConnectorconfigconfiggroovy"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,285 +0,0 @@
</span><del>-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * 
- * U.S. Government Rights - Commercial software. Government users 
- * are subject to the Sun Microsystems, Inc. standard license agreement
- * and applicable provisions of the FAR and its supplements.
- * 
- * Use is subject to license terms.
- * 
- * This distribution may include materials developed by third parties.
- * Sun, Sun Microsystems, the Sun logo, Java and Project Identity 
- * Connectors are trademarks or registered trademarks of Sun 
- * Microsystems, Inc. or its subsidiaries in the U.S. and other
- * countries.
- * 
- * UNIX is a registered trademark in the U.S. and other countries,
- * exclusively licensed through X/Open Company, Ltd. 
- * 
- * -----------
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 
- * 
- * The contents of this file are subject to the terms of the Common Development
- * and Distribution License(CDDL) (the License).  You may not use this file
- * except in  compliance with the License. 
- * 
- * You can obtain a copy of the License at
- * http://identityconnectors.dev.java.net/CDDLv1.0.html
- * See the License for the specific language governing permissions and 
- * limitations under the License.  
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each
- * file and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * -----------
- */
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.contract.data.groovy.Lazy;
-import org.identityconnectors.contract.exceptions.ObjectNotFoundException;
-
-// Unit tests.
-
-sunds.host = '__configureme__'
-sunds.port = 389
-sunds.principal = '__configureme__'
-sunds.credentials = '__configureme__'
-sunds.baseContext = '__configureme__'
-
-// Contract tests.
-
-Object telephoneNumber() {
-    return Lazy.random('### ### ####');
-}
-
-bundleJar = System.getProperty('bundleJar')
-bundleName = System.getProperty('bundleName')
-bundleVersion = System.getProperty('bundleVersion')
-connectorName='org.identityconnectors.ldap.LdapConnector'
-
-baseContext = '__configureme__'
-
-connector {
-    host = '__configureme__'
-    port = 389
-    principal = '__configureme__'
-    credentials = new GuardedString('__configureme__'.toCharArray())
-    baseContexts = [ baseContext ] as String[]
-    usePagedResultControl = true // We do not have a VLV index.
-    uidAttribute = 'entryDN' // Sun DSEE 6.3 does not support entryUUID
-}
-
-Validate.invalidConfig = [
-    [ host : '' ],
-    [ port : 100000 ],
-    [ baseContexts : [] as String[] ]
-]
-
-Test.invalidConfig = [
-    [ principal : 'cn=Nobody' ],
-    [ credentials : 'bogus' ]
-]
-
-Schema {
-    strictCheck = false
-
-    oclasses = [ '__ACCOUNT__', '__GROUP__' ]
-
-    operations = [
-        GetApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        SchemaApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        ValidateApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        CreateApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        SearchApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        DeleteApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        ScriptOnConnectorApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        UpdateApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        AuthenticationApiOp: [ '__ACCOUNT__' ],
-        TestApiOp: [ '__ACCOUNT__', '__GROUP__' ],
-        SyncApiOp: [ ]
-    ]
-
-    attributes.__ACCOUNT__.oclasses = [ '__NAME__', 'cn', 'sn', 'jpegPhoto' ]
-    __NAME__.attribute.__ACCOUNT__.oclasses = [
-        type: java.lang.String.class,
-        readable: true,
-        createable: true,
-        updateable: true,
-        required: true,
-        multiValue: false,
-        returnedByDefault: true
-    ]
-    cn.attribute.__ACCOUNT__.oclasses = [
-        type: java.lang.String.class,
-        readable: true,
-        createable: true,
-        updateable: true,
-        required: true,
-        multiValue: true,
-        returnedByDefault: true
-    ]
-    jpegPhoto.attribute.__ACCOUNT__.oclasses = [
-        type: byte[].class,
-        readable: true,
-        createable: true,
-        updateable: true,
-        required: false,
-        multiValue: true,
-        returnedByDefault: true
-    ]
-
-    attributes.__GROUP__.oclasses = [ '__NAME__', 'cn' ]
-    __NAME__.attribute.__ACCOUNT__.oclasses = [
-        type: java.lang.String.class,
-        readable: true,
-        createable: true,
-        updateable: true,
-        required: true,
-        multiValue: false,
-        returnedByDefault: true
-    ]
-    cn.attribute.__ACCOUNT__.oclasses = [
-        type: java.lang.String.class,
-        readable: true,
-        createable: true,
-        updateable: true,
-        required: true,
-        multiValue: true,
-        returnedByDefault: true
-    ]
-}
-
-objectClasses = [ '__ACCOUNT__', '__GROUP__' ]
-
-Search.disable.caseinsensitive = true
-
-Authentication {
-    __ACCOUNT__ {
-        __NAME__ = 'uid=Bugs Bunny,' + Lazy.get('baseContext')
-        __PASSWORD__ = new GuardedString('password'.toCharArray())
-        username = 'Bugs Bunny'
-        modified.__PASSWORD__ = new GuardedString('newpassword'.toCharArray())
-        wrong.password = new GuardedString('bogus'.toCharArray())
-    }
-}
-
-__ACCOUNT__.__NAME__ = 'uid=' + Lazy.random('Aaaa Aaaa') + ',' + \
                Lazy.get('baseContext')
-__ACCOUNT__.uid = new ObjectNotFoundException() // Since 'uid', as the naming \
                attribute, already has a value.
-
-__ACCOUNT__.homePhone = telephoneNumber()
-__ACCOUNT__.mobile = telephoneNumber()
-__ACCOUNT__.pager = telephoneNumber()
-__ACCOUNT__.telephoneNumber = telephoneNumber()
-
-__ACCOUNT__.x500UniqueIdentifier = new ObjectNotFoundException()
-__ACCOUNT__.manager = new ObjectNotFoundException()
-__ACCOUNT__.internationaliSDNNumber = new ObjectNotFoundException()
-__ACCOUNT__.x121Address = new ObjectNotFoundException()
-__ACCOUNT__.preferredDeliveryMethod = new ObjectNotFoundException()
-__ACCOUNT__.telexNumber = new ObjectNotFoundException()
-__ACCOUNT__.owner = new ObjectNotFoundException()
-__ACCOUNT__.secretary = new ObjectNotFoundException()
-__ACCOUNT__.seeAlso = new ObjectNotFoundException()
-__ACCOUNT__.userPassword = new ObjectNotFoundException()
-__ACCOUNT__.__PASSWORD__ = new ObjectNotFoundException()
-
-__ACCOUNT__.modified.__NAME__ = 'cn=' + Lazy.random('Aaaa Aaaa') + ',' + \
                Lazy.get('baseContext')
-__ACCOUNT__.modified.cn = new ObjectNotFoundException() // Since 'cn', as the naming \
                attribute, already has a value.
-__ACCOUNT__.modified.uid = new ObjectNotFoundException() // Since 'uid', as the \
                previous naming attribute, already has a value.
-
-__ACCOUNT__.modified.homePhone = telephoneNumber()
-__ACCOUNT__.modified.mobile = telephoneNumber()
-__ACCOUNT__.modified.pager = telephoneNumber()
-__ACCOUNT__.modified.telephoneNumber = telephoneNumber()
-
-__ACCOUNT__.modified.x500UniqueIdentifier = new ObjectNotFoundException()
-__ACCOUNT__.modified.manager = new ObjectNotFoundException()
-__ACCOUNT__.modified.internationaliSDNNumber = new ObjectNotFoundException()
-__ACCOUNT__.modified.x121Address = new ObjectNotFoundException()
-__ACCOUNT__.modified.preferredDeliveryMethod = new ObjectNotFoundException()
-__ACCOUNT__.modified.telexNumber = new ObjectNotFoundException()
-__ACCOUNT__.modified.owner = new ObjectNotFoundException()
-__ACCOUNT__.modified.secretary = new ObjectNotFoundException()
-__ACCOUNT__.modified.seeAlso = new ObjectNotFoundException()
-__ACCOUNT__.modified.userPassword = new ObjectNotFoundException()
-__ACCOUNT__.modified.__PASSWORD__ = new ObjectNotFoundException()
-
-__GROUP__.__NAME__ = 'ou=' + Lazy.random('Aaaa Aaaa') + ',' + \
                Lazy.get('baseContext')
-__GROUP__.ou = new ObjectNotFoundException() // Since 'ou', as the naming attribute, \
                already has a value.
-
-__GROUP__.seeAlso = new ObjectNotFoundException()
-__GROUP__.uniqueMember = new ObjectNotFoundException()
-__GROUP__.owner = new ObjectNotFoundException()
-
-__GROUP__.modified.__NAME__ = 'cn=' + Lazy.random('Aaaa Aaaa') + ',' + \
                Lazy.get('baseContext')
-__GROUP__.modified.cn = new ObjectNotFoundException() // Since 'cn', as the naming \
                attribute, already has a value.
-__GROUP__.modified.ou = new ObjectNotFoundException() // Since 'ou', as the previous \
                naming attribute, already has a value.
-
-__GROUP__.modified.seeAlso = new ObjectNotFoundException()
-__GROUP__.modified.uniqueMember = new ObjectNotFoundException()
-__GROUP__.modified.owner = new ObjectNotFoundException()
-
-// Workaround for issue 599.
-added.audio = new ObjectNotFoundException()
-added.businessCategory = new ObjectNotFoundException()
-added.carLicense = new ObjectNotFoundException()
-added.cn = new ObjectNotFoundException()
-added.departmentNumber = new ObjectNotFoundException()
-added.description = new ObjectNotFoundException()
-added.destinationIndicator = new ObjectNotFoundException()
-added.displayName = new ObjectNotFoundException()
-added.employeeNumber = new ObjectNotFoundException()
-added.employeeType = new ObjectNotFoundException()
-added.facsimileTelephoneNumber = new ObjectNotFoundException()
-added.givenName = new ObjectNotFoundException()
-added.homePhone = new ObjectNotFoundException()
-added.homePostalAddress = new ObjectNotFoundException()
-added.initials = new ObjectNotFoundException()
-added.internationaliSDNNumber = new ObjectNotFoundException()
-added.jpegPhoto = new ObjectNotFoundException()
-added.l = new ObjectNotFoundException()
-added.labeledUri = new ObjectNotFoundException()
-added.mail = new ObjectNotFoundException()
-added.manager = new ObjectNotFoundException()
-added.mobile = new ObjectNotFoundException()
-added.o = new ObjectNotFoundException()
-added.ou = new ObjectNotFoundException()
-added.owner = new ObjectNotFoundException()
-added.pager = new ObjectNotFoundException()
-added.photo = new ObjectNotFoundException()
-added.physicalDeliveryOfficeName = new ObjectNotFoundException()
-added.postOfficeBox = new ObjectNotFoundException()
-added.postalAddress = new ObjectNotFoundException()
-added.postalCode = new ObjectNotFoundException()
-added.preferredLanguage = new ObjectNotFoundException()
-added.registeredAddress = new ObjectNotFoundException()
-added.roomNumber = new ObjectNotFoundException()
-added.secretary = new ObjectNotFoundException()
-added.seeAlso = new ObjectNotFoundException()
-added.sn = new ObjectNotFoundException()
-added.st = new ObjectNotFoundException()
-added.street = new ObjectNotFoundException()
-added.telephoneNumber = new ObjectNotFoundException()
-added.teletexTerminalIdentifier = new ObjectNotFoundException()
-added.telexNumber = new ObjectNotFoundException()
-added.title = new ObjectNotFoundException()
-added.uid = new ObjectNotFoundException()
-added.uniqueMember = new ObjectNotFoundException()
-added.userCertificate = new ObjectNotFoundException()
-added.userPKCS12 = new ObjectNotFoundException()
-added.userPassword = new ObjectNotFoundException()
-added.userSMIMECertificate = new ObjectNotFoundException()
-added.x121Address = new ObjectNotFoundException()
-added.x500UniqueIdentifier = new ObjectNotFoundException()
-
-// Workaround for issue 489. This will cause the server to reject the request, so \
                the connector
-// will throw an exception, making the contract tests happy.
-Update.unsupportedAttributeName = 'cn'
-
-// Workaround for issue XXX.
-Sync.disable.create = true
-Sync.disable.update = true
-Sync.disable.delete = true
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestconfigorgidentityconnectorsldapLdapConnec \
torconfigconfiggroovyfromrev6872branchesopenicfldapconnector141xsrctestconfigorgidentityconnectorsldapLdapConnectorconfigconfiggroovy"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/config/org.identityconnectors.ldap.LdapConnector/config/config.groovy	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,285 @@
</span><ins>+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * 
+ * U.S. Government Rights - Commercial software. Government users 
+ * are subject to the Sun Microsystems, Inc. standard license agreement
+ * and applicable provisions of the FAR and its supplements.
+ * 
+ * Use is subject to license terms.
+ * 
+ * This distribution may include materials developed by third parties.
+ * Sun, Sun Microsystems, the Sun logo, Java and Project Identity 
+ * Connectors are trademarks or registered trademarks of Sun 
+ * Microsystems, Inc. or its subsidiaries in the U.S. and other
+ * countries.
+ * 
+ * UNIX is a registered trademark in the U.S. and other countries,
+ * exclusively licensed through X/Open Company, Ltd. 
+ * 
+ * -----------
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 
+ * 
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License(CDDL) (the License).  You may not use this file
+ * except in  compliance with the License. 
+ * 
+ * You can obtain a copy of the License at
+ * http://identityconnectors.dev.java.net/CDDLv1.0.html
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.  
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each
+ * file and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * -----------
+ */
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.contract.data.groovy.Lazy;
+import org.identityconnectors.contract.exceptions.ObjectNotFoundException;
+
+// Unit tests.
+
+sunds.host = '__configureme__'
+sunds.port = 389
+sunds.principal = '__configureme__'
+sunds.credentials = '__configureme__'
+sunds.baseContext = '__configureme__'
+
+// Contract tests.
+
+Object telephoneNumber() {
+    return Lazy.random('### ### ####');
+}
+
+bundleJar = System.getProperty('bundleJar')
+bundleName = System.getProperty('bundleName')
+bundleVersion = System.getProperty('bundleVersion')
+connectorName='org.identityconnectors.ldap.LdapConnector'
+
+baseContext = '__configureme__'
+
+connector {
+    host = '__configureme__'
+    port = 389
+    principal = '__configureme__'
+    credentials = new GuardedString('__configureme__'.toCharArray())
+    baseContexts = [ baseContext ] as String[]
+    usePagedResultControl = true // We do not have a VLV index.
+    uidAttribute = 'entryDN' // Sun DSEE 6.3 does not support entryUUID
+}
+
+Validate.invalidConfig = [
+    [ host : '' ],
+    [ port : 100000 ],
+    [ baseContexts : [] as String[] ]
+]
+
+Test.invalidConfig = [
+    [ principal : 'cn=Nobody' ],
+    [ credentials : 'bogus' ]
+]
+
+Schema {
+    strictCheck = false
+
+    oclasses = [ '__ACCOUNT__', '__GROUP__' ]
+
+    operations = [
+        GetApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        SchemaApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        ValidateApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        CreateApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        SearchApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        DeleteApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        ScriptOnConnectorApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        UpdateApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        AuthenticationApiOp: [ '__ACCOUNT__' ],
+        TestApiOp: [ '__ACCOUNT__', '__GROUP__' ],
+        SyncApiOp: [ ]
+    ]
+
+    attributes.__ACCOUNT__.oclasses = [ '__NAME__', 'cn', 'sn', 'jpegPhoto' ]
+    __NAME__.attribute.__ACCOUNT__.oclasses = [
+        type: java.lang.String.class,
+        readable: true,
+        createable: true,
+        updateable: true,
+        required: true,
+        multiValue: false,
+        returnedByDefault: true
+    ]
+    cn.attribute.__ACCOUNT__.oclasses = [
+        type: java.lang.String.class,
+        readable: true,
+        createable: true,
+        updateable: true,
+        required: true,
+        multiValue: true,
+        returnedByDefault: true
+    ]
+    jpegPhoto.attribute.__ACCOUNT__.oclasses = [
+        type: byte[].class,
+        readable: true,
+        createable: true,
+        updateable: true,
+        required: false,
+        multiValue: true,
+        returnedByDefault: true
+    ]
+
+    attributes.__GROUP__.oclasses = [ '__NAME__', 'cn' ]
+    __NAME__.attribute.__ACCOUNT__.oclasses = [
+        type: java.lang.String.class,
+        readable: true,
+        createable: true,
+        updateable: true,
+        required: true,
+        multiValue: false,
+        returnedByDefault: true
+    ]
+    cn.attribute.__ACCOUNT__.oclasses = [
+        type: java.lang.String.class,
+        readable: true,
+        createable: true,
+        updateable: true,
+        required: true,
+        multiValue: true,
+        returnedByDefault: true
+    ]
+}
+
+objectClasses = [ '__ACCOUNT__', '__GROUP__' ]
+
+Search.disable.caseinsensitive = true
+
+Authentication {
+    __ACCOUNT__ {
+        __NAME__ = 'uid=Bugs Bunny,' + Lazy.get('baseContext')
+        __PASSWORD__ = new GuardedString('password'.toCharArray())
+        username = 'Bugs Bunny'
+        modified.__PASSWORD__ = new GuardedString('newpassword'.toCharArray())
+        wrong.password = new GuardedString('bogus'.toCharArray())
+    }
+}
+
+__ACCOUNT__.__NAME__ = 'uid=' + Lazy.random('Aaaa Aaaa') + ',' + \
Lazy.get('baseContext') +__ACCOUNT__.uid = new ObjectNotFoundException() // Since \
'uid', as the naming attribute, already has a value. +
+__ACCOUNT__.homePhone = telephoneNumber()
+__ACCOUNT__.mobile = telephoneNumber()
+__ACCOUNT__.pager = telephoneNumber()
+__ACCOUNT__.telephoneNumber = telephoneNumber()
+
+__ACCOUNT__.x500UniqueIdentifier = new ObjectNotFoundException()
+__ACCOUNT__.manager = new ObjectNotFoundException()
+__ACCOUNT__.internationaliSDNNumber = new ObjectNotFoundException()
+__ACCOUNT__.x121Address = new ObjectNotFoundException()
+__ACCOUNT__.preferredDeliveryMethod = new ObjectNotFoundException()
+__ACCOUNT__.telexNumber = new ObjectNotFoundException()
+__ACCOUNT__.owner = new ObjectNotFoundException()
+__ACCOUNT__.secretary = new ObjectNotFoundException()
+__ACCOUNT__.seeAlso = new ObjectNotFoundException()
+__ACCOUNT__.userPassword = new ObjectNotFoundException()
+__ACCOUNT__.__PASSWORD__ = new ObjectNotFoundException()
+
+__ACCOUNT__.modified.__NAME__ = 'cn=' + Lazy.random('Aaaa Aaaa') + ',' + \
Lazy.get('baseContext') +__ACCOUNT__.modified.cn = new ObjectNotFoundException() // \
Since 'cn', as the naming attribute, already has a value. +__ACCOUNT__.modified.uid = \
new ObjectNotFoundException() // Since 'uid', as the previous naming attribute, \
already has a value. +
+__ACCOUNT__.modified.homePhone = telephoneNumber()
+__ACCOUNT__.modified.mobile = telephoneNumber()
+__ACCOUNT__.modified.pager = telephoneNumber()
+__ACCOUNT__.modified.telephoneNumber = telephoneNumber()
+
+__ACCOUNT__.modified.x500UniqueIdentifier = new ObjectNotFoundException()
+__ACCOUNT__.modified.manager = new ObjectNotFoundException()
+__ACCOUNT__.modified.internationaliSDNNumber = new ObjectNotFoundException()
+__ACCOUNT__.modified.x121Address = new ObjectNotFoundException()
+__ACCOUNT__.modified.preferredDeliveryMethod = new ObjectNotFoundException()
+__ACCOUNT__.modified.telexNumber = new ObjectNotFoundException()
+__ACCOUNT__.modified.owner = new ObjectNotFoundException()
+__ACCOUNT__.modified.secretary = new ObjectNotFoundException()
+__ACCOUNT__.modified.seeAlso = new ObjectNotFoundException()
+__ACCOUNT__.modified.userPassword = new ObjectNotFoundException()
+__ACCOUNT__.modified.__PASSWORD__ = new ObjectNotFoundException()
+
+__GROUP__.__NAME__ = 'ou=' + Lazy.random('Aaaa Aaaa') + ',' + \
Lazy.get('baseContext') +__GROUP__.ou = new ObjectNotFoundException() // Since 'ou', \
as the naming attribute, already has a value. +
+__GROUP__.seeAlso = new ObjectNotFoundException()
+__GROUP__.uniqueMember = new ObjectNotFoundException()
+__GROUP__.owner = new ObjectNotFoundException()
+
+__GROUP__.modified.__NAME__ = 'cn=' + Lazy.random('Aaaa Aaaa') + ',' + \
Lazy.get('baseContext') +__GROUP__.modified.cn = new ObjectNotFoundException() // \
Since 'cn', as the naming attribute, already has a value. +__GROUP__.modified.ou = \
new ObjectNotFoundException() // Since 'ou', as the previous naming attribute, \
already has a value. +
+__GROUP__.modified.seeAlso = new ObjectNotFoundException()
+__GROUP__.modified.uniqueMember = new ObjectNotFoundException()
+__GROUP__.modified.owner = new ObjectNotFoundException()
+
+// Workaround for issue 599.
+added.audio = new ObjectNotFoundException()
+added.businessCategory = new ObjectNotFoundException()
+added.carLicense = new ObjectNotFoundException()
+added.cn = new ObjectNotFoundException()
+added.departmentNumber = new ObjectNotFoundException()
+added.description = new ObjectNotFoundException()
+added.destinationIndicator = new ObjectNotFoundException()
+added.displayName = new ObjectNotFoundException()
+added.employeeNumber = new ObjectNotFoundException()
+added.employeeType = new ObjectNotFoundException()
+added.facsimileTelephoneNumber = new ObjectNotFoundException()
+added.givenName = new ObjectNotFoundException()
+added.homePhone = new ObjectNotFoundException()
+added.homePostalAddress = new ObjectNotFoundException()
+added.initials = new ObjectNotFoundException()
+added.internationaliSDNNumber = new ObjectNotFoundException()
+added.jpegPhoto = new ObjectNotFoundException()
+added.l = new ObjectNotFoundException()
+added.labeledUri = new ObjectNotFoundException()
+added.mail = new ObjectNotFoundException()
+added.manager = new ObjectNotFoundException()
+added.mobile = new ObjectNotFoundException()
+added.o = new ObjectNotFoundException()
+added.ou = new ObjectNotFoundException()
+added.owner = new ObjectNotFoundException()
+added.pager = new ObjectNotFoundException()
+added.photo = new ObjectNotFoundException()
+added.physicalDeliveryOfficeName = new ObjectNotFoundException()
+added.postOfficeBox = new ObjectNotFoundException()
+added.postalAddress = new ObjectNotFoundException()
+added.postalCode = new ObjectNotFoundException()
+added.preferredLanguage = new ObjectNotFoundException()
+added.registeredAddress = new ObjectNotFoundException()
+added.roomNumber = new ObjectNotFoundException()
+added.secretary = new ObjectNotFoundException()
+added.seeAlso = new ObjectNotFoundException()
+added.sn = new ObjectNotFoundException()
+added.st = new ObjectNotFoundException()
+added.street = new ObjectNotFoundException()
+added.telephoneNumber = new ObjectNotFoundException()
+added.teletexTerminalIdentifier = new ObjectNotFoundException()
+added.telexNumber = new ObjectNotFoundException()
+added.title = new ObjectNotFoundException()
+added.uid = new ObjectNotFoundException()
+added.uniqueMember = new ObjectNotFoundException()
+added.userCertificate = new ObjectNotFoundException()
+added.userPKCS12 = new ObjectNotFoundException()
+added.userPassword = new ObjectNotFoundException()
+added.userSMIMECertificate = new ObjectNotFoundException()
+added.x121Address = new ObjectNotFoundException()
+added.x500UniqueIdentifier = new ObjectNotFoundException()
+
+// Workaround for issue 489. This will cause the server to reject the request, so \
the connector +// will throw an exception, making the contract tests happy.
+Update.unsupportedAttributeName = 'cn'
+
+// Workaround for issue XXX.
+Sync.disable.create = true
+Sync.disable.update = true
+Sync.disable.delete = true
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAdapterCompatibilityTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,545 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.singleton;
-import static org.identityconnectors.common.CollectionUtil.newList;
-import static org.identityconnectors.common.CollectionUtil.newSet;
-import static org.identityconnectors.ldap.LdapUtil.checkedListByFilter;
-import java.io.UnsupportedEncodingException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.common.exceptions.ConnectorException;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.AttributeInfo;
-import org.identityconnectors.framework.common.objects.AttributeInfoUtil;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.ObjectClassInfo;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.identityconnectors.framework.common.objects.filter.Filter;
-import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
-import org.identityconnectors.ldap.schema.LdapSchemaMapping;
-import org.identityconnectors.test.common.TestHelpers;
-
-public class AdapterCompatibilityTests extends LdapConnectorTestBase {
-
-    // TODO test authenticate.
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return true;
-    }
-
-    @Test
-    public void testAccountOperationalAttributes() {
-        ConnectorFacade facade = newFacade();
-        ObjectClassInfo oci = \
                facade.schema().findObjectClassInfo(ObjectClass.ACCOUNT_NAME);
-
-        AttributeInfo info = \
                AttributeInfoUtil.find(OperationalAttributes.PASSWORD_NAME, \
                oci.getAttributeInfo());
-        assertEquals(LdapConstants.PASSWORD, info);
-    }
-
-    @Test
-    public void testAccountAttributes() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject user0 = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(USER_0_DN), &quot;uid&quot;, &quot;cn&quot;, &quot;givenName&quot;, \
                &quot;sn&quot;);
-
-        assertEquals(USER_0_DN, user0.getName().getNameValue());
-        assertEquals(USER_0_UID, \
                AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;uid&quot;)));
                
-        assertEquals(USER_0_CN, \
                AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;cn&quot;)));
                
-        assertEquals(USER_0_GIVEN_NAME, \
                AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;givenName&quot;)));
                
-        assertEquals(USER_0_SN, \
                AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;sn&quot;)));
                
-    }
-
-    @Test
-    public void testGroupAttributes() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.GROUP, new \
                Name(UNIQUE_BUGS_AND_FRIENDS_DN), &quot;cn&quot;, \
                &quot;uniqueMember&quot;);
-
-        assertEquals(UNIQUE_BUGS_AND_FRIENDS_CN, \
                AttributeUtil.getAsStringValue(object.getAttributeByName(&quot;cn&quot;)));
                
-        Attribute uniqueMember = \
                object.getAttributeByName(&quot;uniqueMember&quot;);
-        assertTrue(uniqueMember.getValue().contains(BUGS_BUNNY_DN));
-    }
-
-    @Test
-    public void testOrganizationAttributes() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject object = searchByAttribute(facade, new \
ObjectClass(&quot;organization&quot;), new Name(ACME_DN), &quot;dn&quot;, \
                &quot;o&quot;, &quot;objectClass&quot;);
-
-        assertEquals(ACME_DN, object.getName().getNameValue());
-        assertEquals(ACME_DN, \
                AttributeUtil.getAsStringValue(object.getAttributeByName(&quot;dn&quot;)));
                
-        assertEquals(ACME_O, \
                AttributeUtil.getAsStringValue(object.getAttributeByName(&quot;o&quot;)));
                
-    }
-
-    @Test
-    public void testInetOrgPersonAttributes() {
-        // The LDAP edit group form does exactly this operation.
-
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(ACME_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;cn&quot;, &quot;dn&quot;);
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, new \
                ObjectClass(&quot;inetOrgPerson&quot;), null, builder.build());
-
-        ConnectorObject object = findByAttribute(objects, &quot;dn&quot;, \
                BUGS_BUNNY_DN);
-        assertEquals(BUGS_BUNNY_CN, \
                AttributeUtil.getStringValue(object.getAttributeByName(&quot;cn&quot;)));
                
-    }
-
-    @Test
-    public void testCreateGroupOfUniqueNamesWithoutMembers() {
-        LdapConfiguration config = newConfiguration();
-        ConnectorFacade facade = newFacade(config);
-
-        ObjectClass oclass = new ObjectClass(&quot;groupOfUniqueNames&quot;);
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        Name name = new Name(&quot;cn=Another Group,&quot; + ACME_DN);
-        attributes.add(name);
-        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Another \
                Group&quot;));
-        // If &quot;uniqueMember&quot; is sent to the server as an empty attribute, \
                the server complains.
-        // The test makes sure it is not sent at all.
-        attributes.add(AttributeBuilder.build(&quot;uniqueMember&quot;, \
                emptyList()));
-        Uid uid = facade.create(oclass, attributes, null);
-
-        ConnectorObject newGroup = facade.getObject(oclass, uid, null);
-        assertEquals(name, newGroup.getName());
-    }
-
-    @Test
-    public void testRetriveLdapGroups() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN), LdapConstants.LDAP_GROUPS_NAME);
-        assertAttributeValue(newList(UNIQUE_BUGS_AND_FRIENDS_DN, \
                UNIQUE_EXTERNAL_PEERS_DN),
-                object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME));
-
-        LdapConfiguration config = newConfiguration();
-        config.setGroupMemberAttribute(&quot;member&quot;);
-        facade = newFacade(config);
-        object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN), LdapConstants.LDAP_GROUPS_NAME);
-        assertAttributeValue(newList(BUGS_AND_FRIENDS_DN, EXTERNAL_PEERS_DN),
-                object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME));
-    }
-
-    @Test
-    public void testRetrivePosixGroups() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN), LdapConstants.POSIX_GROUPS_NAME);
-        assertAttributeValue(newList(POSIX_BUGS_AND_FRIENDS_DN, \
                POSIX_EXTERNAL_PEERS_DN),
-                object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME));
-    }
-
-    @Test
-    public void testCreateWithUniqueLdapGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME,
-                UNIQUE_BUGS_AND_FRIENDS_DN, UNIQUE_EXTERNAL_PEERS_DN);
-        doTestCreateWithGroups(facade, groupsAttr);
-    }
-
-    @Test
-    public void testCreateWithLdapGroups() {
-        ConnectorFacade facade = newFacade();
-        LdapConfiguration config = newConfiguration();
-        config.setGroupMemberAttribute(&quot;member&quot;); // For groupOfNames.
-        facade = newFacade(config);
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME,
-                BUGS_AND_FRIENDS_DN, EXTERNAL_PEERS_DN);
-        doTestCreateWithGroups(facade, groupsAttr);
-    }
-
-    @Test
-    public void testCreateWithPosixGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME,
-                POSIX_BUGS_AND_FRIENDS_DN, POSIX_EXTERNAL_PEERS_DN);
-        doTestCreateWithGroups(facade, groupsAttr);
-    }
-
-    private void doTestCreateWithGroups(ConnectorFacade facade, Attribute \
                groupsAttr) {
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        attributes.add(new Name(&quot;uid=porky.pig,&quot; + ACME_USERS_DN));
-        attributes.add(AttributeBuilder.build(&quot;uid&quot;, \
                &quot;porky.pig&quot;));
-        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Porky \
                Pig&quot;));
-        attributes.add(AttributeBuilder.build(&quot;givenName&quot;, \
                &quot;Porky&quot;));
-        attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Pig&quot;));
-        attributes.add(groupsAttr);
-        Uid uid = facade.create(ObjectClass.ACCOUNT, attributes, null);
-
-        assertAttributeValue(groupsAttr.getValue(), facade, ObjectClass.ACCOUNT, \
                uid, groupsAttr.getName());
-    }
-
-    @Test
-    public void testAddLdapGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, \
                UNIQUE_EMPTY_GROUP_DN);
-        doTestAddGroups(facade, groupsAttr);
-    }
-
-    @Test
-    public void testAddPosixGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME, \
                POSIX_EMPTY_GROUP_DN);
-        doTestAddGroups(facade, groupsAttr);
-    }
-
-    private void doTestAddGroups(ConnectorFacade facade, Attribute groupsAttr) {
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN), groupsAttr.getName());
-        List&lt;Object&gt; oldGroups = \
                newList(object.getAttributeByName(groupsAttr.getName()).getValue());
-
-        Uid uid = facade.addAttributeValues(ObjectClass.ACCOUNT, object.getUid(), \
                singleton(groupsAttr), null);
-
-        oldGroups.addAll(groupsAttr.getValue());
-        assertAttributeValue(oldGroups, facade, ObjectClass.ACCOUNT, uid, \
                groupsAttr.getName());
-    }
-
-    @Test
-    public void testUpdateUniqueLdapGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, \
                UNIQUE_EXTERNAL_PEERS_DN);
-        doTestUpdateGroups(facade, groupsAttr);
-    }
-
-    @Test
-    public void testUpdatePosixGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, \
                UNIQUE_EXTERNAL_PEERS_DN);
-        doTestUpdateGroups(facade, groupsAttr);
-    }
-
-    private void doTestUpdateGroups(ConnectorFacade facade, Attribute groupsAttr) {
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN), groupsAttr.getName());
-
-        Uid uid = facade.update(ObjectClass.ACCOUNT, object.getUid(), \
                singleton(groupsAttr), null);
-
-        assertAttributeValue(groupsAttr.getValue(), facade, ObjectClass.ACCOUNT, \
                uid, groupsAttr.getName());
-    }
-
-    @Test
-    public void testRemoveUniqueLdapGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, \
                UNIQUE_EXTERNAL_PEERS_DN);
-        doTestRemoveGroups(facade, groupsAttr);
-    }
-
-    @Test
-    public void testRemovePosixGroups() {
-        ConnectorFacade facade = newFacade();
-
-        Attribute groupsAttr = \
                AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME, \
                POSIX_EXTERNAL_PEERS_DN);
-        doTestRemoveGroups(facade, groupsAttr);
-    }
-
-    private void doTestRemoveGroups(ConnectorFacade facade, Attribute groupsAttr) {
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN), groupsAttr.getName());
-        List&lt;Object&gt; oldGroups = \
                newList(object.getAttributeByName(groupsAttr.getName()).getValue());
-
-        Uid uid = facade.removeAttributeValues(ObjectClass.ACCOUNT, object.getUid(), \
                singleton(groupsAttr), null);
-
-        oldGroups.removeAll(groupsAttr.getValue());
-        assertAttributeValue(oldGroups, facade, ObjectClass.ACCOUNT, uid, \
                groupsAttr.getName());
-    }
-
-    @Test(expectedExceptions = ConnectorException.class)
-    public void testCannotRemoveUidWhenInPosixGroups() {
-        ConnectorFacade facade = newFacade();
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        Attribute uidAttr = AttributeBuilder.build(&quot;uid&quot;, BBUNNY_UID);
-        facade.removeAttributeValues(ObjectClass.ACCOUNT, object.getUid(), \
                singleton(uidAttr), null);
-    }
-
-    @Test(expectedExceptions = ConnectorException.class)
-    public void testCannotUpdateUidToNoneWhenInPosixGroups() {
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(ACME_DN, SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(OWNER_DN));
-        Attribute uidAttr = AttributeBuilder.build(&quot;uid&quot;);
-        facade.update(ObjectClass.ACCOUNT, object.getUid(), singleton(uidAttr), \
                null);
-    }
-
-    @Test
-    public void testRenameMaintainsGroupMemberships() {
-        LdapConfiguration config = newConfiguration();
-        config.setMaintainLdapGroupMembership(true);
-        config.setMaintainPosixGroupMembership(true);
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN),
-                LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME);
-        List&lt;String&gt; oldLdapGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME).getValue(), \
                String.class);
-        List&lt;String&gt; oldPosixGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME).getValue(), \
                String.class);
-
-        Name newName = new Name(&quot;uid=sylvester.the.cat,&quot; + ACME_USERS_DN);
-        Uid uid = facade.update(ObjectClass.ACCOUNT, object.getUid(), \
                singleton((Attribute) newName), null);
-
-        object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
                LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME);
-        assertAttributeValue(newList(UNIQUE_BUGS_AND_FRIENDS_DN, \
                UNIQUE_EXTERNAL_PEERS_DN),
-                object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME));
-        assertAttributeValue(newList(POSIX_BUGS_AND_FRIENDS_DN, \
                POSIX_EXTERNAL_PEERS_DN),
-                object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME));
-
-        // Also need to test that the old entries were actually removed from the old \
                groups.
-        for (String group : oldLdapGroups) {
-            object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(group), \
                &quot;uniqueMember&quot;);
-            List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-            assertFalse(&quot;Group &quot; + group + &quot; should not contain \
                &quot; + SYLVESTER_DN, members.contains(SYLVESTER_DN));
-        }
-        for (String group : oldPosixGroups) {
-            object = searchByAttribute(facade, new \
                ObjectClass(&quot;posixGroup&quot;), new Name(group), \
                &quot;memberUid&quot;);
-            List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;memberUid&quot;).getValue();
-            assertFalse(&quot;Group &quot; + group + &quot; should not contain \
                &quot; + SYLVESTER_UID, members.contains(SYLVESTER_UID));
-        }
-    }
-
-    @Test
-    public void testRenameAndUpdateGroupMemberships() {
-        LdapConfiguration config = newConfiguration();
-        config.setMaintainLdapGroupMembership(true);
-        config.setMaintainPosixGroupMembership(true);
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN),
-                LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME);
-        List&lt;String&gt; oldLdapGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME).getValue(), \
                String.class);
-        List&lt;String&gt; oldPosixGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME).getValue(), \
                String.class);
-
-        Name newName = new Name(&quot;uid=sylvester.the.cat,&quot; + ACME_USERS_DN);
-        Attribute ldapGroupsAttr = \
                AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME,
-                UNIQUE_EXTERNAL_PEERS_DN, UNIQUE_EMPTY_GROUP_DN);
-        Attribute posixGroupsAttr = \
                AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME,
-                POSIX_EXTERNAL_PEERS_DN, POSIX_EMPTY_GROUP_DN);
-        Uid uid = facade.update(ObjectClass.ACCOUNT, object.getUid(), \
                newSet(newName, ldapGroupsAttr, posixGroupsAttr), null);
-
-        object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
                LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME);
-        assertAttributeValue(ldapGroupsAttr.getValue(), \
                object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME));
-        assertAttributeValue(posixGroupsAttr.getValue(), \
                object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME));
-
-        // Also need to test that the old entries were actually removed from the old \
                groups.
-        for (String group : oldLdapGroups) {
-            object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(group), \
                &quot;uniqueMember&quot;);
-            List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-            assertFalse(&quot;Group &quot; + group + &quot; should not contain \
                &quot; + SYLVESTER_DN, members.contains(SYLVESTER_DN));
-        }
-        for (String group : oldPosixGroups) {
-            object = searchByAttribute(facade, new \
                ObjectClass(&quot;posixGroup&quot;), new Name(group), \
                &quot;memberUid&quot;);
-            List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;memberUid&quot;).getValue();
-            assertFalse(&quot;Group &quot; + group + &quot; should not contain \
                &quot; + SYLVESTER_UID, members.contains(SYLVESTER_UID));
-        }
-    }
-
-    @Test
-    public void testRenameDoesNotMaintainGroupMembershipsUnlessConfigured() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.isMaintainLdapGroupMembership());
-        assertFalse(config.isMaintainPosixGroupMembership());
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN));
-        String newUid = &quot;sylvester.the.cat&quot;;
-        String newEntryDN = &quot;uid=&quot; + newUid + &quot;,&quot; + \
                ACME_USERS_DN;
-        facade.update(ObjectClass.ACCOUNT, object.getUid(), singleton((Attribute) \
                new Name(newEntryDN)), null);
-
-        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_BUGS_AND_FRIENDS_DN), \
                &quot;uniqueMember&quot;);
-        List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_DN));
-        assertFalse(members.contains(newEntryDN));
-
-        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_EXTERNAL_PEERS_DN), \
                &quot;uniqueMember&quot;);
-        members = object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_DN));
-        assertFalse(members.contains(newEntryDN));
-
-        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
                new Name(POSIX_BUGS_AND_FRIENDS_DN), &quot;memberUid&quot;);
-        members = object.getAttributeByName(&quot;memberUid&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_UID));
-        assertFalse(members.contains(newUid));
-
-        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
                new Name(POSIX_EXTERNAL_PEERS_DN), &quot;memberUid&quot;);
-        members = object.getAttributeByName(&quot;memberUid&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_UID));
-        assertFalse(members.contains(newUid));
-    }
-
-    @Test
-    public void testDeleteMaintainsGroupMemberships() {
-        LdapConfiguration config = newConfiguration();
-        config.setMaintainLdapGroupMembership(true);
-        config.setMaintainPosixGroupMembership(true);
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN),
-                LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME);
-        List&lt;String&gt; oldLdapGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME).getValue(), \
                String.class);
-        List&lt;String&gt; oldPosixGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME).getValue(), \
                String.class);
-
-        facade.delete(ObjectClass.ACCOUNT, object.getUid(), null);
-
-        // Need to test that the old entries were actually removed from the old \
                groups.
-        for (String group : oldLdapGroups) {
-            object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(group), \
                &quot;uniqueMember&quot;);
-            List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-            assertFalse(&quot;Group &quot; + group + &quot; should not contain \
                &quot; + SYLVESTER_DN, members.contains(SYLVESTER_DN));
-        }
-        for (String group : oldPosixGroups) {
-            object = searchByAttribute(facade, new \
                ObjectClass(&quot;posixGroup&quot;), new Name(group), \
                &quot;memberUid&quot;);
-            List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;memberUid&quot;).getValue();
-            assertFalse(&quot;Group &quot; + group + &quot; should not contain \
                &quot; + SYLVESTER_UID, members.contains(SYLVESTER_UID));
-        }
-    }
-
-    @Test
-    public void testDeleteDoesNotMaintainGroupMembershipsUnlessConfigured() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.isMaintainLdapGroupMembership());
-        assertFalse(config.isMaintainPosixGroupMembership());
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(SYLVESTER_DN));
-        facade.delete(ObjectClass.ACCOUNT, object.getUid(), null);
-
-        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_BUGS_AND_FRIENDS_DN), \
                &quot;uniqueMember&quot;);
-        List&lt;Object&gt; members = \
                object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_DN));
-
-        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_EXTERNAL_PEERS_DN), \
                &quot;uniqueMember&quot;);
-        members = object.getAttributeByName(&quot;uniqueMember&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_DN));
-
-        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
                new Name(POSIX_BUGS_AND_FRIENDS_DN), &quot;memberUid&quot;);
-        members = object.getAttributeByName(&quot;memberUid&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_UID));
-
-        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
                new Name(POSIX_EXTERNAL_PEERS_DN), &quot;memberUid&quot;);
-        members = object.getAttributeByName(&quot;memberUid&quot;).getValue();
-        assertTrue(members.contains(SYLVESTER_UID));
-    }
-
-    @Test
-    public void testPasswordHashing() throws Exception {
-        LdapConfiguration config = newConfiguration();
-        config.setPasswordHashAlgorithm(&quot;SHA&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        doTestPasswordHashing(facade, &quot;SHA&quot;);
-    }
-
-    @Test
-    public void testSaltedPasswordHashing() throws Exception {
-        LdapConfiguration config = newConfiguration();
-        config.setPasswordHashAlgorithm(&quot;SSHA&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        doTestPasswordHashing(facade, &quot;SSHA&quot;);
-    }
-
-    private void doTestPasswordHashing(ConnectorFacade facade, String algorithm) \
                throws UnsupportedEncodingException {
-        String algorithmLabel = &quot;{&quot; + algorithm + &quot;}&quot;;
-
-        Set&lt;Attribute&gt; attrs = new HashSet&lt;Attribute&gt;();
-        attrs.add(new Name(&quot;uid=daffy.duck,&quot; + ACME_USERS_DN));
-        attrs.add(AttributeBuilder.build(&quot;uid&quot;, &quot;daffy.duck&quot;));
-        attrs.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Daffy Duck&quot;));
-        attrs.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Duck&quot;));
-        attrs.add(AttributeBuilder.build(&quot;ds-pwp-password-policy-dn&quot;, \
                &quot;cn=Clear Text Password Policy,cn=Password \
                Policies,cn=config&quot;));
-        GuardedString password = new \
                GuardedString(&quot;foobar&quot;.toCharArray());
-        attrs.add(AttributeBuilder.buildPassword(password));
-        Uid uid = facade.create(ObjectClass.ACCOUNT, attrs, null);
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
                &quot;userPassword&quot;);
-        byte[] passwordBytes = (byte[]) \
                object.getAttributeByName(&quot;userPassword&quot;).getValue().get(0);
                
-        assertTrue(new String(passwordBytes, \
                &quot;UTF-8&quot;).startsWith(algorithmLabel));
-        facade.authenticate(ObjectClass.ACCOUNT, &quot;daffy.duck&quot;, password, \
                null);
-
-        password = new GuardedString(&quot;newpassword&quot;.toCharArray());
-        facade.update(ObjectClass.ACCOUNT, object.getUid(), \
                singleton(AttributeBuilder.buildPassword(password)), null);
-
-        object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
                &quot;userPassword&quot;);
-        passwordBytes = (byte[]) \
                object.getAttributeByName(&quot;userPassword&quot;).getValue().get(0);
                
-        assertTrue(new String(passwordBytes, \
                &quot;UTF-8&quot;).startsWith(algorithmLabel));
-        facade.authenticate(ObjectClass.ACCOUNT, &quot;daffy.duck&quot;, password, \
                null);
-    }
-
-    @Test
-    public void testSearchAnyObjectClass() {
-        ConnectorFacade facade = newFacade();
-
-        Filter filter = FilterBuilder.equalTo(AttributeBuilder.build(Name.NAME, \
                BUGS_BUNNY_DN));
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;cn&quot;, &quot;dn&quot;);
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                LdapSchemaMapping.ANY_OBJECT_CLASS, filter, builder.build());
-
-        ConnectorObject bunny = objects.get(0);
-        assertEquals(LdapSchemaMapping.ANY_OBJECT_CLASS, bunny.getObjectClass());
-        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
-        assertEquals(BUGS_BUNNY_CN, \
                bunny.getAttributeByName(&quot;cn&quot;).getValue().get(0));
-    }
-
-    @Test
-    public void testSearchFilter() {
-        ConnectorFacade facade = newFacade();
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setOption(LdapConstants.SEARCH_FILTER_NAME, &quot;(uid=&quot; + \
                BUGS_BUNNY_UID + &quot;)&quot;);
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                ObjectClass.ACCOUNT, null, builder.build());
-
-        assertEquals(1, objects.size());
-        ConnectorObject bunny = objects.get(0);
-        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
-    }
-
-    private static void assertAttributeValue(List&lt;?&gt; expected, ConnectorFacade \
                facade, ObjectClass oclass, Uid uid, String attrName) {
-        ConnectorObject object = searchByAttribute(facade, oclass, uid, attrName);
-        assertAttributeValue(expected, object.getAttributeByName(attrName));
-    }
-
-    private static void assertAttributeValue(List&lt;?&gt; expected, Attribute attr) \
                {
-        Set&lt;?&gt; attrValue = newSet(attr.getValue());
-        Set&lt;?&gt; expectedValue = newSet(expected);
-        assertEquals(expectedValue, attrValue);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAdapterCompa \
tibilityTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapAdapterCompatibilityTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AdapterCompatibilityTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,545 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singleton;
+import static org.identityconnectors.common.CollectionUtil.newList;
+import static org.identityconnectors.common.CollectionUtil.newSet;
+import static org.identityconnectors.ldap.LdapUtil.checkedListByFilter;
+import java.io.UnsupportedEncodingException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.AttributeInfo;
+import org.identityconnectors.framework.common.objects.AttributeInfoUtil;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.ObjectClassInfo;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.identityconnectors.framework.common.objects.filter.Filter;
+import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
+import org.identityconnectors.ldap.schema.LdapSchemaMapping;
+import org.identityconnectors.test.common.TestHelpers;
+
+public class AdapterCompatibilityTests extends LdapConnectorTestBase {
+
+    // TODO test authenticate.
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return true;
+    }
+
+    @Test
+    public void testAccountOperationalAttributes() {
+        ConnectorFacade facade = newFacade();
+        ObjectClassInfo oci = \
facade.schema().findObjectClassInfo(ObjectClass.ACCOUNT_NAME); +
+        AttributeInfo info = \
AttributeInfoUtil.find(OperationalAttributes.PASSWORD_NAME, oci.getAttributeInfo()); \
+        assertEquals(LdapConstants.PASSWORD, info); +    }
+
+    @Test
+    public void testAccountAttributes() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject user0 = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(USER_0_DN), &quot;uid&quot;, &quot;cn&quot;, &quot;givenName&quot;, \
&quot;sn&quot;); +
+        assertEquals(USER_0_DN, user0.getName().getNameValue());
+        assertEquals(USER_0_UID, \
AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;uid&quot;))); +        \
assertEquals(USER_0_CN, \
AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;cn&quot;))); +        \
assertEquals(USER_0_GIVEN_NAME, \
AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;givenName&quot;))); +   \
assertEquals(USER_0_SN, \
AttributeUtil.getAsStringValue(user0.getAttributeByName(&quot;sn&quot;))); +    }
+
+    @Test
+    public void testGroupAttributes() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.GROUP, new \
Name(UNIQUE_BUGS_AND_FRIENDS_DN), &quot;cn&quot;, &quot;uniqueMember&quot;); +
+        assertEquals(UNIQUE_BUGS_AND_FRIENDS_CN, \
AttributeUtil.getAsStringValue(object.getAttributeByName(&quot;cn&quot;))); +        \
Attribute uniqueMember = object.getAttributeByName(&quot;uniqueMember&quot;); +       \
assertTrue(uniqueMember.getValue().contains(BUGS_BUNNY_DN)); +    }
+
+    @Test
+    public void testOrganizationAttributes() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject object = searchByAttribute(facade, new \
ObjectClass(&quot;organization&quot;), new Name(ACME_DN), &quot;dn&quot;, \
&quot;o&quot;, &quot;objectClass&quot;); +
+        assertEquals(ACME_DN, object.getName().getNameValue());
+        assertEquals(ACME_DN, \
AttributeUtil.getAsStringValue(object.getAttributeByName(&quot;dn&quot;))); +        \
assertEquals(ACME_O, \
AttributeUtil.getAsStringValue(object.getAttributeByName(&quot;o&quot;))); +    }
+
+    @Test
+    public void testInetOrgPersonAttributes() {
+        // The LDAP edit group form does exactly this operation.
+
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(ACME_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;cn&quot;, &quot;dn&quot;);
+        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, new \
ObjectClass(&quot;inetOrgPerson&quot;), null, builder.build()); +
+        ConnectorObject object = findByAttribute(objects, &quot;dn&quot;, \
BUGS_BUNNY_DN); +        assertEquals(BUGS_BUNNY_CN, \
AttributeUtil.getStringValue(object.getAttributeByName(&quot;cn&quot;))); +    }
+
+    @Test
+    public void testCreateGroupOfUniqueNamesWithoutMembers() {
+        LdapConfiguration config = newConfiguration();
+        ConnectorFacade facade = newFacade(config);
+
+        ObjectClass oclass = new ObjectClass(&quot;groupOfUniqueNames&quot;);
+        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
+        Name name = new Name(&quot;cn=Another Group,&quot; + ACME_DN);
+        attributes.add(name);
+        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Another \
Group&quot;)); +        // If &quot;uniqueMember&quot; is sent to the server as an \
empty attribute, the server complains. +        // The test makes sure it is not sent \
at all. +        attributes.add(AttributeBuilder.build(&quot;uniqueMember&quot;, \
emptyList())); +        Uid uid = facade.create(oclass, attributes, null);
+
+        ConnectorObject newGroup = facade.getObject(oclass, uid, null);
+        assertEquals(name, newGroup.getName());
+    }
+
+    @Test
+    public void testRetriveLdapGroups() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), LdapConstants.LDAP_GROUPS_NAME); +        \
assertAttributeValue(newList(UNIQUE_BUGS_AND_FRIENDS_DN, UNIQUE_EXTERNAL_PEERS_DN), + \
object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME)); +
+        LdapConfiguration config = newConfiguration();
+        config.setGroupMemberAttribute(&quot;member&quot;);
+        facade = newFacade(config);
+        object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), LdapConstants.LDAP_GROUPS_NAME); +        \
assertAttributeValue(newList(BUGS_AND_FRIENDS_DN, EXTERNAL_PEERS_DN), +               \
object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME)); +    }
+
+    @Test
+    public void testRetrivePosixGroups() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), LdapConstants.POSIX_GROUPS_NAME); +        \
assertAttributeValue(newList(POSIX_BUGS_AND_FRIENDS_DN, POSIX_EXTERNAL_PEERS_DN), +   \
object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME)); +    }
+
+    @Test
+    public void testCreateWithUniqueLdapGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, +                \
UNIQUE_BUGS_AND_FRIENDS_DN, UNIQUE_EXTERNAL_PEERS_DN); +        \
doTestCreateWithGroups(facade, groupsAttr); +    }
+
+    @Test
+    public void testCreateWithLdapGroups() {
+        ConnectorFacade facade = newFacade();
+        LdapConfiguration config = newConfiguration();
+        config.setGroupMemberAttribute(&quot;member&quot;); // For groupOfNames.
+        facade = newFacade(config);
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, +                \
BUGS_AND_FRIENDS_DN, EXTERNAL_PEERS_DN); +        doTestCreateWithGroups(facade, \
groupsAttr); +    }
+
+    @Test
+    public void testCreateWithPosixGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME, +                \
POSIX_BUGS_AND_FRIENDS_DN, POSIX_EXTERNAL_PEERS_DN); +        \
doTestCreateWithGroups(facade, groupsAttr); +    }
+
+    private void doTestCreateWithGroups(ConnectorFacade facade, Attribute \
groupsAttr) { +        Set&lt;Attribute&gt; attributes = new \
HashSet&lt;Attribute&gt;(); +        attributes.add(new \
Name(&quot;uid=porky.pig,&quot; + ACME_USERS_DN)); +        \
attributes.add(AttributeBuilder.build(&quot;uid&quot;, &quot;porky.pig&quot;)); +     \
attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Porky Pig&quot;)); +      \
attributes.add(AttributeBuilder.build(&quot;givenName&quot;, &quot;Porky&quot;)); +   \
attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Pig&quot;)); +        \
attributes.add(groupsAttr); +        Uid uid = facade.create(ObjectClass.ACCOUNT, \
attributes, null); +
+        assertAttributeValue(groupsAttr.getValue(), facade, ObjectClass.ACCOUNT, \
uid, groupsAttr.getName()); +    }
+
+    @Test
+    public void testAddLdapGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, UNIQUE_EMPTY_GROUP_DN); +      \
doTestAddGroups(facade, groupsAttr); +    }
+
+    @Test
+    public void testAddPosixGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME, POSIX_EMPTY_GROUP_DN); +      \
doTestAddGroups(facade, groupsAttr); +    }
+
+    private void doTestAddGroups(ConnectorFacade facade, Attribute groupsAttr) {
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN), groupsAttr.getName()); +        List&lt;Object&gt; oldGroups = \
newList(object.getAttributeByName(groupsAttr.getName()).getValue()); +
+        Uid uid = facade.addAttributeValues(ObjectClass.ACCOUNT, object.getUid(), \
singleton(groupsAttr), null); +
+        oldGroups.addAll(groupsAttr.getValue());
+        assertAttributeValue(oldGroups, facade, ObjectClass.ACCOUNT, uid, \
groupsAttr.getName()); +    }
+
+    @Test
+    public void testUpdateUniqueLdapGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, UNIQUE_EXTERNAL_PEERS_DN); +   \
doTestUpdateGroups(facade, groupsAttr); +    }
+
+    @Test
+    public void testUpdatePosixGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, UNIQUE_EXTERNAL_PEERS_DN); +   \
doTestUpdateGroups(facade, groupsAttr); +    }
+
+    private void doTestUpdateGroups(ConnectorFacade facade, Attribute groupsAttr) {
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), groupsAttr.getName()); +
+        Uid uid = facade.update(ObjectClass.ACCOUNT, object.getUid(), \
singleton(groupsAttr), null); +
+        assertAttributeValue(groupsAttr.getValue(), facade, ObjectClass.ACCOUNT, \
uid, groupsAttr.getName()); +    }
+
+    @Test
+    public void testRemoveUniqueLdapGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, UNIQUE_EXTERNAL_PEERS_DN); +   \
doTestRemoveGroups(facade, groupsAttr); +    }
+
+    @Test
+    public void testRemovePosixGroups() {
+        ConnectorFacade facade = newFacade();
+
+        Attribute groupsAttr = \
AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME, POSIX_EXTERNAL_PEERS_DN); +   \
doTestRemoveGroups(facade, groupsAttr); +    }
+
+    private void doTestRemoveGroups(ConnectorFacade facade, Attribute groupsAttr) {
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), groupsAttr.getName()); +        List&lt;Object&gt; oldGroups = \
newList(object.getAttributeByName(groupsAttr.getName()).getValue()); +
+        Uid uid = facade.removeAttributeValues(ObjectClass.ACCOUNT, object.getUid(), \
singleton(groupsAttr), null); +
+        oldGroups.removeAll(groupsAttr.getValue());
+        assertAttributeValue(oldGroups, facade, ObjectClass.ACCOUNT, uid, \
groupsAttr.getName()); +    }
+
+    @Test(expectedExceptions = ConnectorException.class)
+    public void testCannotRemoveUidWhenInPosixGroups() {
+        ConnectorFacade facade = newFacade();
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        Attribute uidAttr = \
AttributeBuilder.build(&quot;uid&quot;, BBUNNY_UID); +        \
facade.removeAttributeValues(ObjectClass.ACCOUNT, object.getUid(), \
singleton(uidAttr), null); +    }
+
+    @Test(expectedExceptions = ConnectorException.class)
+    public void testCannotUpdateUidToNoneWhenInPosixGroups() {
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(ACME_DN, SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(OWNER_DN)); +        Attribute uidAttr = \
AttributeBuilder.build(&quot;uid&quot;); +        facade.update(ObjectClass.ACCOUNT, \
object.getUid(), singleton(uidAttr), null); +    }
+
+    @Test
+    public void testRenameMaintainsGroupMemberships() {
+        LdapConfiguration config = newConfiguration();
+        config.setMaintainLdapGroupMembership(true);
+        config.setMaintainPosixGroupMembership(true);
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), +                LdapConstants.LDAP_GROUPS_NAME, \
LdapConstants.POSIX_GROUPS_NAME); +        List&lt;String&gt; oldLdapGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME).getValue(), \
String.class); +        List&lt;String&gt; oldPosixGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME).getValue(), \
String.class); +
+        Name newName = new Name(&quot;uid=sylvester.the.cat,&quot; + ACME_USERS_DN);
+        Uid uid = facade.update(ObjectClass.ACCOUNT, object.getUid(), \
singleton((Attribute) newName), null); +
+        object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME); +        \
assertAttributeValue(newList(UNIQUE_BUGS_AND_FRIENDS_DN, UNIQUE_EXTERNAL_PEERS_DN), + \
object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME)); +        \
assertAttributeValue(newList(POSIX_BUGS_AND_FRIENDS_DN, POSIX_EXTERNAL_PEERS_DN), +   \
object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME)); +
+        // Also need to test that the old entries were actually removed from the old \
groups. +        for (String group : oldLdapGroups) {
+            object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(group), \
&quot;uniqueMember&quot;); +            List&lt;Object&gt; members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +            \
assertFalse(&quot;Group &quot; + group + &quot; should not contain &quot; + \
SYLVESTER_DN, members.contains(SYLVESTER_DN)); +        }
+        for (String group : oldPosixGroups) {
+            object = searchByAttribute(facade, new \
ObjectClass(&quot;posixGroup&quot;), new Name(group), &quot;memberUid&quot;); +       \
List&lt;Object&gt; members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +            \
assertFalse(&quot;Group &quot; + group + &quot; should not contain &quot; + \
SYLVESTER_UID, members.contains(SYLVESTER_UID)); +        }
+    }
+
+    @Test
+    public void testRenameAndUpdateGroupMemberships() {
+        LdapConfiguration config = newConfiguration();
+        config.setMaintainLdapGroupMembership(true);
+        config.setMaintainPosixGroupMembership(true);
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), +                LdapConstants.LDAP_GROUPS_NAME, \
LdapConstants.POSIX_GROUPS_NAME); +        List&lt;String&gt; oldLdapGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME).getValue(), \
String.class); +        List&lt;String&gt; oldPosixGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME).getValue(), \
String.class); +
+        Name newName = new Name(&quot;uid=sylvester.the.cat,&quot; + ACME_USERS_DN);
+        Attribute ldapGroupsAttr = \
AttributeBuilder.build(LdapConstants.LDAP_GROUPS_NAME, +                \
UNIQUE_EXTERNAL_PEERS_DN, UNIQUE_EMPTY_GROUP_DN); +        Attribute posixGroupsAttr \
= AttributeBuilder.build(LdapConstants.POSIX_GROUPS_NAME, +                \
POSIX_EXTERNAL_PEERS_DN, POSIX_EMPTY_GROUP_DN); +        Uid uid = \
facade.update(ObjectClass.ACCOUNT, object.getUid(), newSet(newName, ldapGroupsAttr, \
posixGroupsAttr), null); +
+        object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
LdapConstants.LDAP_GROUPS_NAME, LdapConstants.POSIX_GROUPS_NAME); +        \
assertAttributeValue(ldapGroupsAttr.getValue(), \
object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME)); +        \
assertAttributeValue(posixGroupsAttr.getValue(), \
object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME)); +
+        // Also need to test that the old entries were actually removed from the old \
groups. +        for (String group : oldLdapGroups) {
+            object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(group), \
&quot;uniqueMember&quot;); +            List&lt;Object&gt; members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +            \
assertFalse(&quot;Group &quot; + group + &quot; should not contain &quot; + \
SYLVESTER_DN, members.contains(SYLVESTER_DN)); +        }
+        for (String group : oldPosixGroups) {
+            object = searchByAttribute(facade, new \
ObjectClass(&quot;posixGroup&quot;), new Name(group), &quot;memberUid&quot;); +       \
List&lt;Object&gt; members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +            \
assertFalse(&quot;Group &quot; + group + &quot; should not contain &quot; + \
SYLVESTER_UID, members.contains(SYLVESTER_UID)); +        }
+    }
+
+    @Test
+    public void testRenameDoesNotMaintainGroupMembershipsUnlessConfigured() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.isMaintainLdapGroupMembership());
+        assertFalse(config.isMaintainPosixGroupMembership());
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN)); +        String newUid = &quot;sylvester.the.cat&quot;;
+        String newEntryDN = &quot;uid=&quot; + newUid + &quot;,&quot; + \
ACME_USERS_DN; +        facade.update(ObjectClass.ACCOUNT, object.getUid(), \
singleton((Attribute) new Name(newEntryDN)), null); +
+        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_BUGS_AND_FRIENDS_DN), \
&quot;uniqueMember&quot;); +        List&lt;Object&gt; members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_DN)); +        \
assertFalse(members.contains(newEntryDN)); +
+        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_EXTERNAL_PEERS_DN), \
&quot;uniqueMember&quot;); +        members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_DN)); +        \
assertFalse(members.contains(newEntryDN)); +
+        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
new Name(POSIX_BUGS_AND_FRIENDS_DN), &quot;memberUid&quot;); +        members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_UID)); +        \
assertFalse(members.contains(newUid)); +
+        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
new Name(POSIX_EXTERNAL_PEERS_DN), &quot;memberUid&quot;); +        members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_UID)); +        \
assertFalse(members.contains(newUid)); +    }
+
+    @Test
+    public void testDeleteMaintainsGroupMemberships() {
+        LdapConfiguration config = newConfiguration();
+        config.setMaintainLdapGroupMembership(true);
+        config.setMaintainPosixGroupMembership(true);
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN), +                LdapConstants.LDAP_GROUPS_NAME, \
LdapConstants.POSIX_GROUPS_NAME); +        List&lt;String&gt; oldLdapGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.LDAP_GROUPS_NAME).getValue(), \
String.class); +        List&lt;String&gt; oldPosixGroups = \
checkedListByFilter(object.getAttributeByName(LdapConstants.POSIX_GROUPS_NAME).getValue(), \
String.class); +
+        facade.delete(ObjectClass.ACCOUNT, object.getUid(), null);
+
+        // Need to test that the old entries were actually removed from the old \
groups. +        for (String group : oldLdapGroups) {
+            object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(group), \
&quot;uniqueMember&quot;); +            List&lt;Object&gt; members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +            \
assertFalse(&quot;Group &quot; + group + &quot; should not contain &quot; + \
SYLVESTER_DN, members.contains(SYLVESTER_DN)); +        }
+        for (String group : oldPosixGroups) {
+            object = searchByAttribute(facade, new \
ObjectClass(&quot;posixGroup&quot;), new Name(group), &quot;memberUid&quot;); +       \
List&lt;Object&gt; members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +            \
assertFalse(&quot;Group &quot; + group + &quot; should not contain &quot; + \
SYLVESTER_UID, members.contains(SYLVESTER_UID)); +        }
+    }
+
+    @Test
+    public void testDeleteDoesNotMaintainGroupMembershipsUnlessConfigured() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.isMaintainLdapGroupMembership());
+        assertFalse(config.isMaintainPosixGroupMembership());
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(SYLVESTER_DN)); +        facade.delete(ObjectClass.ACCOUNT, object.getUid(), \
null); +
+        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_BUGS_AND_FRIENDS_DN), \
&quot;uniqueMember&quot;); +        List&lt;Object&gt; members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_DN)); +
+        object = searchByAttribute(facade, new \
ObjectClass(&quot;groupOfUniqueNames&quot;), new Name(UNIQUE_EXTERNAL_PEERS_DN), \
&quot;uniqueMember&quot;); +        members = \
object.getAttributeByName(&quot;uniqueMember&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_DN)); +
+        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
new Name(POSIX_BUGS_AND_FRIENDS_DN), &quot;memberUid&quot;); +        members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_UID)); +
+        object = searchByAttribute(facade, new ObjectClass(&quot;posixGroup&quot;), \
new Name(POSIX_EXTERNAL_PEERS_DN), &quot;memberUid&quot;); +        members = \
object.getAttributeByName(&quot;memberUid&quot;).getValue(); +        \
assertTrue(members.contains(SYLVESTER_UID)); +    }
+
+    @Test
+    public void testPasswordHashing() throws Exception {
+        LdapConfiguration config = newConfiguration();
+        config.setPasswordHashAlgorithm(&quot;SHA&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        doTestPasswordHashing(facade, &quot;SHA&quot;);
+    }
+
+    @Test
+    public void testSaltedPasswordHashing() throws Exception {
+        LdapConfiguration config = newConfiguration();
+        config.setPasswordHashAlgorithm(&quot;SSHA&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        doTestPasswordHashing(facade, &quot;SSHA&quot;);
+    }
+
+    private void doTestPasswordHashing(ConnectorFacade facade, String algorithm) \
throws UnsupportedEncodingException { +        String algorithmLabel = &quot;{&quot; \
+ algorithm + &quot;}&quot;; +
+        Set&lt;Attribute&gt; attrs = new HashSet&lt;Attribute&gt;();
+        attrs.add(new Name(&quot;uid=daffy.duck,&quot; + ACME_USERS_DN));
+        attrs.add(AttributeBuilder.build(&quot;uid&quot;, &quot;daffy.duck&quot;));
+        attrs.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Daffy Duck&quot;));
+        attrs.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Duck&quot;));
+        attrs.add(AttributeBuilder.build(&quot;ds-pwp-password-policy-dn&quot;, \
&quot;cn=Clear Text Password Policy,cn=Password Policies,cn=config&quot;)); +        \
GuardedString password = new GuardedString(&quot;foobar&quot;.toCharArray()); +       \
attrs.add(AttributeBuilder.buildPassword(password)); +        Uid uid = \
facade.create(ObjectClass.ACCOUNT, attrs, null); +
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
&quot;userPassword&quot;); +        byte[] passwordBytes = (byte[]) \
object.getAttributeByName(&quot;userPassword&quot;).getValue().get(0); +        \
assertTrue(new String(passwordBytes, &quot;UTF-8&quot;).startsWith(algorithmLabel)); \
+        facade.authenticate(ObjectClass.ACCOUNT, &quot;daffy.duck&quot;, password, \
null); +
+        password = new GuardedString(&quot;newpassword&quot;.toCharArray());
+        facade.update(ObjectClass.ACCOUNT, object.getUid(), \
singleton(AttributeBuilder.buildPassword(password)), null); +
+        object = searchByAttribute(facade, ObjectClass.ACCOUNT, uid, \
&quot;userPassword&quot;); +        passwordBytes = (byte[]) \
object.getAttributeByName(&quot;userPassword&quot;).getValue().get(0); +        \
assertTrue(new String(passwordBytes, &quot;UTF-8&quot;).startsWith(algorithmLabel)); \
+        facade.authenticate(ObjectClass.ACCOUNT, &quot;daffy.duck&quot;, password, \
null); +    }
+
+    @Test
+    public void testSearchAnyObjectClass() {
+        ConnectorFacade facade = newFacade();
+
+        Filter filter = FilterBuilder.equalTo(AttributeBuilder.build(Name.NAME, \
BUGS_BUNNY_DN)); +        OperationOptionsBuilder builder = new \
OperationOptionsBuilder(); +        builder.setAttributesToGet(&quot;cn&quot;, \
&quot;dn&quot;); +        List&lt;ConnectorObject&gt; objects = \
TestHelpers.searchToList(facade, LdapSchemaMapping.ANY_OBJECT_CLASS, filter, \
builder.build()); +
+        ConnectorObject bunny = objects.get(0);
+        assertEquals(LdapSchemaMapping.ANY_OBJECT_CLASS, bunny.getObjectClass());
+        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
+        assertEquals(BUGS_BUNNY_CN, \
bunny.getAttributeByName(&quot;cn&quot;).getValue().get(0)); +    }
+
+    @Test
+    public void testSearchFilter() {
+        ConnectorFacade facade = newFacade();
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setOption(LdapConstants.SEARCH_FILTER_NAME, &quot;(uid=&quot; + \
BUGS_BUNNY_UID + &quot;)&quot;); +        List&lt;ConnectorObject&gt; objects = \
TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, builder.build()); +
+        assertEquals(1, objects.size());
+        ConnectorObject bunny = objects.get(0);
+        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
+    }
+
+    private static void assertAttributeValue(List&lt;?&gt; expected, ConnectorFacade \
facade, ObjectClass oclass, Uid uid, String attrName) { +        ConnectorObject \
object = searchByAttribute(facade, oclass, uid, attrName); +        \
assertAttributeValue(expected, object.getAttributeByName(attrName)); +    }
+
+    private static void assertAttributeValue(List&lt;?&gt; expected, Attribute attr) \
{ +        Set&lt;?&gt; attrValue = newSet(attr.getValue());
+        Set&lt;?&gt; expectedValue = newSet(expected);
+        assertEquals(expectedValue, attrValue);
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAppendingAttributesTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,200 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import org.testng.AssertJUnit;
-import org.testng.Assert;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-
-public class AppendingAttributesTests {
-
-    private Attribute foo, existingFoo, existingCapitalFoo;
-    private Attribute bar, existingBar;
-
-    @BeforeMethod
-	public void before() {
-        foo = new BasicAttribute(&quot;foo&quot;, &quot;Foo&quot;);
-        existingFoo = new BasicAttribute(&quot;foo&quot;, &quot;Existing Foo&quot;);
-        existingCapitalFoo = new BasicAttribute(&quot;FOO&quot;, &quot;EXISTING \
                FOO&quot;);
-        bar = new BasicAttribute(&quot;bar&quot;, &quot;Bar&quot;);
-        existingBar = new BasicAttribute(&quot;bar&quot;, &quot;Existing Bar&quot;);
-    }
-
-    @Test
-    public void testAppending() throws Exception {
-        BasicAttributes existingAttrs = new BasicAttributes(true);
-        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
                bar);
-        AssertJUnit.assertEquals(2, appendingAttrs.size());
-        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
-        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
-        AssertJUnit.assertEquals(foo, appendingAttrs.get(&quot;FOO&quot;));
-        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
-    }
-
-    @Test
-    public void testAppendAndReplaceCaseInsensitive() throws Exception {
-        BasicAttributes existingAttrs = new BasicAttributes(true);
-        existingAttrs.put(existingCapitalFoo);
-        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
                bar);
-        AssertJUnit.assertEquals(2, appendingAttrs.size());
-        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
-        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
-        AssertJUnit.assertEquals(foo, appendingAttrs.get(&quot;FOO&quot;));
-        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
-    }
-
-    @Test
-    public void testAppendCaseInsensitive() throws Exception {
-        BasicAttributes existingAttrs = new BasicAttributes(false);
-        existingAttrs.put(existingCapitalFoo);
-        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
                bar);
-        AssertJUnit.assertEquals(3, appendingAttrs.size());
-        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
-        assertHasAttribute(existingCapitalFoo, &quot;FOO&quot;, appendingAttrs);
-        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
-        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
-    }
-
-    @Test
-    public void testReplace() throws Exception {
-        BasicAttributes existingAttrs = new BasicAttributes(true);
-        existingAttrs.put(existingFoo);
-        existingAttrs.put(existingBar);
-        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
                bar);
-        AssertJUnit.assertEquals(2, appendingAttrs.size());
-        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
-        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
-        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
-    }
-
-    private void assertHasAttribute(Attribute expected, String attrID, Attributes \
                attrs) throws NamingException {
-        AssertJUnit.assertEquals(expected, attrs.get(attrID));
-
-        AssertJUnit.assertEquals(expected, findAttrUsingEnumMore(attrs.getAll(), \
                attrID));
-        AssertJUnit.assertEquals(expected, \
                findAttrUsingEnumMoreElements(attrs.getAll(), attrID));
-        AssertJUnit.assertEquals(attrID, findAttrIDUsingEnumMore(attrs.getIDs(), \
                attrID));
-        AssertJUnit.assertEquals(attrID, \
                findAttrIDUsingEnumMoreElements(attrs.getIDs(), attrID));
-    }
-
-    private static Attribute findAttrUsingEnumMore(NamingEnumeration&lt;? extends \
                Attribute&gt; attrEnum, String attrID) throws NamingException {
-        Attribute attr = null;
-        int found = 0;
-        while (attrEnum.hasMore()) {
-            Attribute nextAttr = attrEnum.next();
-            if (nextAttr.getID().equals(attrID)) {
-                attr = nextAttr;
-                found++;
-            }
-        }
-        AssertJUnit.assertEquals(1, found);
-        return attr;
-    }
-
-    private static Attribute findAttrUsingEnumMoreElements(NamingEnumeration&lt;? \
                extends Attribute&gt; attrEnum, String attrID) {
-        Attribute attr = null;
-        int found = 0;
-        while (attrEnum.hasMoreElements()) {
-            Attribute nextAttr = attrEnum.nextElement();
-            if (nextAttr.getID().equals(attrID)) {
-                attr = nextAttr;
-                found++;
-            }
-        }
-        AssertJUnit.assertEquals(1, found);
-        return attr;
-    }
-
-    private static String findAttrIDUsingEnumMore(NamingEnumeration&lt;String&gt; \
                idEnum, String attrID) throws NamingException {
-        String id = null;
-        int found = 0;
-        while (idEnum.hasMore()) {
-            String nextID = idEnum.next();
-            if (nextID.equals(attrID)) {
-                id = nextID;
-                found++;
-            }
-        }
-        AssertJUnit.assertEquals(1, found);
-        return id;
-    }
-
-    private static String \
findAttrIDUsingEnumMoreElements(NamingEnumeration&lt;String&gt; idEnum, String \
                attrID) {
-        String id = null;
-        int found = 0;
-        while (idEnum.hasMoreElements()) {
-            String nextID = idEnum.nextElement();
-            if (nextID.equals(attrID)) {
-                id = nextID;
-                found++;
-            }
-        }
-        AssertJUnit.assertEquals(1, found);
-        return id;
-    }
-
-    private static final class AppendingAttrImpl extends AppendingAttributes {
-
-        private static final long serialVersionUID = 1L;
-
-        private final Attribute[] toAppend;
-
-        public AppendingAttrImpl(Attributes delegate, Attribute... toAppend) {
-            super(delegate);
-            this.toAppend = toAppend;
-        }
-
-        @Override
-        public Object clone() {
-            return new AppendingAttrImpl((Attributes) delegate.clone(), toAppend);
-        }
-
-        @Override
-        protected Attribute getAttributeToAppend(String attrID) {
-            for (Attribute attr : toAppend) {
-                if (attrID.equals(attr.getID())) {
-                    return attr;
-                }
-            }
-            return null;
-        }
-
-        @Override
-        protected Set&lt;String&gt; getAttributeIDsToAppend() {
-            Set&lt;String&gt; result = new HashSet&lt;String&gt;();
-            for (Attribute attr : toAppend) {
-                result.add(attr.getID());
-            }
-            return result;
-        }
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapAppendingAtt \
ributesTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapAppendingAttributesTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/AppendingAttributesTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,200 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.AssertJUnit;
+import org.testng.Assert;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+public class AppendingAttributesTests {
+
+    private Attribute foo, existingFoo, existingCapitalFoo;
+    private Attribute bar, existingBar;
+
+    @BeforeMethod
+	public void before() {
+        foo = new BasicAttribute(&quot;foo&quot;, &quot;Foo&quot;);
+        existingFoo = new BasicAttribute(&quot;foo&quot;, &quot;Existing Foo&quot;);
+        existingCapitalFoo = new BasicAttribute(&quot;FOO&quot;, &quot;EXISTING \
FOO&quot;); +        bar = new BasicAttribute(&quot;bar&quot;, &quot;Bar&quot;);
+        existingBar = new BasicAttribute(&quot;bar&quot;, &quot;Existing Bar&quot;);
+    }
+
+    @Test
+    public void testAppending() throws Exception {
+        BasicAttributes existingAttrs = new BasicAttributes(true);
+        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
bar); +        AssertJUnit.assertEquals(2, appendingAttrs.size());
+        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
+        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
+        AssertJUnit.assertEquals(foo, appendingAttrs.get(&quot;FOO&quot;));
+        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
+    }
+
+    @Test
+    public void testAppendAndReplaceCaseInsensitive() throws Exception {
+        BasicAttributes existingAttrs = new BasicAttributes(true);
+        existingAttrs.put(existingCapitalFoo);
+        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
bar); +        AssertJUnit.assertEquals(2, appendingAttrs.size());
+        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
+        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
+        AssertJUnit.assertEquals(foo, appendingAttrs.get(&quot;FOO&quot;));
+        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
+    }
+
+    @Test
+    public void testAppendCaseInsensitive() throws Exception {
+        BasicAttributes existingAttrs = new BasicAttributes(false);
+        existingAttrs.put(existingCapitalFoo);
+        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
bar); +        AssertJUnit.assertEquals(3, appendingAttrs.size());
+        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
+        assertHasAttribute(existingCapitalFoo, &quot;FOO&quot;, appendingAttrs);
+        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
+        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
+    }
+
+    @Test
+    public void testReplace() throws Exception {
+        BasicAttributes existingAttrs = new BasicAttributes(true);
+        existingAttrs.put(existingFoo);
+        existingAttrs.put(existingBar);
+        AppendingAttrImpl appendingAttrs = new AppendingAttrImpl(existingAttrs, foo, \
bar); +        AssertJUnit.assertEquals(2, appendingAttrs.size());
+        assertHasAttribute(foo, &quot;foo&quot;, appendingAttrs);
+        assertHasAttribute(bar, &quot;bar&quot;, appendingAttrs);
+        Assert.assertNull(existingAttrs.get(&quot;inexistent&quot;));
+    }
+
+    private void assertHasAttribute(Attribute expected, String attrID, Attributes \
attrs) throws NamingException { +        AssertJUnit.assertEquals(expected, \
attrs.get(attrID)); +
+        AssertJUnit.assertEquals(expected, findAttrUsingEnumMore(attrs.getAll(), \
attrID)); +        AssertJUnit.assertEquals(expected, \
findAttrUsingEnumMoreElements(attrs.getAll(), attrID)); +        \
AssertJUnit.assertEquals(attrID, findAttrIDUsingEnumMore(attrs.getIDs(), attrID)); +  \
AssertJUnit.assertEquals(attrID, findAttrIDUsingEnumMoreElements(attrs.getIDs(), \
attrID)); +    }
+
+    private static Attribute findAttrUsingEnumMore(NamingEnumeration&lt;? extends \
Attribute&gt; attrEnum, String attrID) throws NamingException { +        Attribute \
attr = null; +        int found = 0;
+        while (attrEnum.hasMore()) {
+            Attribute nextAttr = attrEnum.next();
+            if (nextAttr.getID().equals(attrID)) {
+                attr = nextAttr;
+                found++;
+            }
+        }
+        AssertJUnit.assertEquals(1, found);
+        return attr;
+    }
+
+    private static Attribute findAttrUsingEnumMoreElements(NamingEnumeration&lt;? \
extends Attribute&gt; attrEnum, String attrID) { +        Attribute attr = null;
+        int found = 0;
+        while (attrEnum.hasMoreElements()) {
+            Attribute nextAttr = attrEnum.nextElement();
+            if (nextAttr.getID().equals(attrID)) {
+                attr = nextAttr;
+                found++;
+            }
+        }
+        AssertJUnit.assertEquals(1, found);
+        return attr;
+    }
+
+    private static String findAttrIDUsingEnumMore(NamingEnumeration&lt;String&gt; \
idEnum, String attrID) throws NamingException { +        String id = null;
+        int found = 0;
+        while (idEnum.hasMore()) {
+            String nextID = idEnum.next();
+            if (nextID.equals(attrID)) {
+                id = nextID;
+                found++;
+            }
+        }
+        AssertJUnit.assertEquals(1, found);
+        return id;
+    }
+
+    private static String \
findAttrIDUsingEnumMoreElements(NamingEnumeration&lt;String&gt; idEnum, String \
attrID) { +        String id = null;
+        int found = 0;
+        while (idEnum.hasMoreElements()) {
+            String nextID = idEnum.nextElement();
+            if (nextID.equals(attrID)) {
+                id = nextID;
+                found++;
+            }
+        }
+        AssertJUnit.assertEquals(1, found);
+        return id;
+    }
+
+    private static final class AppendingAttrImpl extends AppendingAttributes {
+
+        private static final long serialVersionUID = 1L;
+
+        private final Attribute[] toAppend;
+
+        public AppendingAttrImpl(Attributes delegate, Attribute... toAppend) {
+            super(delegate);
+            this.toAppend = toAppend;
+        }
+
+        @Override
+        public Object clone() {
+            return new AppendingAttrImpl((Attributes) delegate.clone(), toAppend);
+        }
+
+        @Override
+        protected Attribute getAttributeToAppend(String attrID) {
+            for (Attribute attr : toAppend) {
+                if (attrID.equals(attr.getID())) {
+                    return attr;
+                }
+            }
+            return null;
+        }
+
+        @Override
+        protected Set&lt;String&gt; getAttributeIDsToAppend() {
+            Set&lt;String&gt; result = new HashSet&lt;String&gt;();
+            for (Attribute attr : toAppend) {
+                result.add(attr.getID());
+            }
+            return result;
+        }
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapAuthenticateTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,142 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import static org.testng.AssertJUnit.assertEquals;
-import org.testng.annotations.Test;
-import org.testng.Assert;
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.common.exceptions.ConnectorSecurityException;
                
-import org.identityconnectors.framework.common.exceptions.PasswordExpiredException;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.Uid;
-
-public class LdapAuthenticateTests extends LdapConnectorTestBase {
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return false;
-    }
-
-    @Test
-    public void testAuthenticateWithDefaultConfiguration() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        Uid uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, new \
                GuardedString(&quot;carrot&quot;.toCharArray()), null);
-        assertEquals(bugs.getUid(), uid);
-        uid = facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, null);
-        assertEquals(bugs.getUid(), uid);
-
-        uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, new \
                GuardedString(&quot;carrot&quot;.toCharArray()), null);
-        assertEquals(bugs.getUid(), uid);
-        uid = facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, null);
-        assertEquals(bugs.getUid(), uid);
-    }
-
-    @Test
-    public void testAuthenticateWithCustomAttributes() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setOption(LdapConstants.LDAP_UID_ATTRS_NAME, new String[] { \
                &quot;sn&quot; });
-        OperationOptions options = builder.build();
-        Uid uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_SN, new \
                GuardedString(&quot;carrot&quot;.toCharArray()), options);
-        assertEquals(bugs.getUid(), uid);
-        uid = facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_SN, options);
-        assertEquals(bugs.getUid(), uid);
-
-        // Should not be possible to authenticate with the attributes from the \
                default configuration (&quot;cn&quot;...
-        try {
-            facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, new \
                GuardedString(&quot;carrot&quot;.toCharArray()), options);
-            Assert.fail();
-        } catch (ConnectorSecurityException e) { }
-        try {
-            facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, options);
-            Assert.fail();
-        } catch (ConnectorSecurityException e) { }
-
-        // ... and &quot;uid&quot;).
-        try {
-            uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, new \
                GuardedString(&quot;carrot&quot;.toCharArray()), options);
-            Assert.fail();
-        } catch (ConnectorSecurityException e) { }
-        try {
-            uid = facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, \
                options);
-            Assert.fail();
-        } catch (ConnectorSecurityException e) { }
-    }
-
-    @Test
-    public void testAuthenticateWithEntryDN() {
-        LdapConfiguration config = newConfiguration();
-        config.setAccountUserNameAttributes(&quot;entryDN&quot;);
-        ConnectorFacade facade = newFacade(config);
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        Uid uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_DN, new \
                GuardedString(&quot;carrot&quot;.toCharArray()), null);
-        assertEquals(bugs.getUid(), uid);
-        uid = facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_DN, null);
-        assertEquals(bugs.getUid(), uid);
-    }
-
-    @Test(expectedExceptions = ConnectorSecurityException.class)
-    public void testAuthenticateInvalidPassword() {
-        ConnectorFacade facade = newFacade();
-        facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, new \
                GuardedString(&quot;rabbithole&quot;.toCharArray()), null);
-    }
-
-    @Test
-    public void testAuthenticateUnknownAccount() {
-        ConnectorFacade facade = newFacade();
-        try {
-            facade.authenticate(ObjectClass.ACCOUNT, \
&quot;hopefully.inexisting.user&quot;, new \
                GuardedString(&quot;none&quot;.toCharArray()), null);
-            Assert.fail();
-        } catch (ConnectorSecurityException e) { }
-        try {
-            facade.resolveUsername(ObjectClass.ACCOUNT, \
                &quot;hopefully.inexisting.user&quot;, null);
-            Assert.fail();
-        } catch (ConnectorSecurityException e) { }
-    }
-
-    @Test
-    public void testAuthenticateExpiredPassword() {
-        LdapConfiguration config = newConfiguration();
-        config.setRespectResourcePasswordPolicyChangeAfterReset(false);
-        ConnectorFacade facade = newFacade(config);
-        facade.authenticate(ObjectClass.ACCOUNT, EXPIRED_UID, new \
                GuardedString(&quot;password&quot;.toCharArray()), null);
-
-        config = newConfiguration();
-        config.setRespectResourcePasswordPolicyChangeAfterReset(true);
-        facade = newFacade(config);
-        try {
-            facade.authenticate(ObjectClass.ACCOUNT, EXPIRED_UID, new \
                GuardedString(&quot;password&quot;.toCharArray()), null);
-            Assert.fail();
-        } catch (PasswordExpiredException e) {
-            // OK.
-        }
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapAuthenti \
cateTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapLdapAuthenticateTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapAuthenticateTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,142 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.common.exceptions.ConnectorSecurityException;
 +import org.identityconnectors.framework.common.exceptions.PasswordExpiredException;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.Uid;
+
+public class LdapAuthenticateTests extends LdapConnectorTestBase {
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return false;
+    }
+
+    @Test
+    public void testAuthenticateWithDefaultConfiguration() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        Uid uid = facade.authenticate(ObjectClass.ACCOUNT, \
BUGS_BUNNY_CN, new GuardedString(&quot;carrot&quot;.toCharArray()), null); +        \
assertEquals(bugs.getUid(), uid); +        uid = \
facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, null); +        \
assertEquals(bugs.getUid(), uid); +
+        uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, new \
GuardedString(&quot;carrot&quot;.toCharArray()), null); +        \
assertEquals(bugs.getUid(), uid); +        uid = \
facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, null); +        \
assertEquals(bugs.getUid(), uid); +    }
+
+    @Test
+    public void testAuthenticateWithCustomAttributes() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        OperationOptionsBuilder builder = new \
OperationOptionsBuilder(); +        \
builder.setOption(LdapConstants.LDAP_UID_ATTRS_NAME, new String[] { &quot;sn&quot; \
}); +        OperationOptions options = builder.build();
+        Uid uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_SN, new \
GuardedString(&quot;carrot&quot;.toCharArray()), options); +        \
assertEquals(bugs.getUid(), uid); +        uid = \
facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_SN, options); +        \
assertEquals(bugs.getUid(), uid); +
+        // Should not be possible to authenticate with the attributes from the \
default configuration (&quot;cn&quot;... +        try {
+            facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, new \
GuardedString(&quot;carrot&quot;.toCharArray()), options); +            \
Assert.fail(); +        } catch (ConnectorSecurityException e) { }
+        try {
+            facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, options);
+            Assert.fail();
+        } catch (ConnectorSecurityException e) { }
+
+        // ... and &quot;uid&quot;).
+        try {
+            uid = facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, new \
GuardedString(&quot;carrot&quot;.toCharArray()), options); +            \
Assert.fail(); +        } catch (ConnectorSecurityException e) { }
+        try {
+            uid = facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_UID, \
options); +            Assert.fail();
+        } catch (ConnectorSecurityException e) { }
+    }
+
+    @Test
+    public void testAuthenticateWithEntryDN() {
+        LdapConfiguration config = newConfiguration();
+        config.setAccountUserNameAttributes(&quot;entryDN&quot;);
+        ConnectorFacade facade = newFacade(config);
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        Uid uid = facade.authenticate(ObjectClass.ACCOUNT, \
BUGS_BUNNY_DN, new GuardedString(&quot;carrot&quot;.toCharArray()), null); +        \
assertEquals(bugs.getUid(), uid); +        uid = \
facade.resolveUsername(ObjectClass.ACCOUNT, BUGS_BUNNY_DN, null); +        \
assertEquals(bugs.getUid(), uid); +    }
+
+    @Test(expectedExceptions = ConnectorSecurityException.class)
+    public void testAuthenticateInvalidPassword() {
+        ConnectorFacade facade = newFacade();
+        facade.authenticate(ObjectClass.ACCOUNT, BUGS_BUNNY_CN, new \
GuardedString(&quot;rabbithole&quot;.toCharArray()), null); +    }
+
+    @Test
+    public void testAuthenticateUnknownAccount() {
+        ConnectorFacade facade = newFacade();
+        try {
+            facade.authenticate(ObjectClass.ACCOUNT, \
&quot;hopefully.inexisting.user&quot;, new \
GuardedString(&quot;none&quot;.toCharArray()), null); +            Assert.fail();
+        } catch (ConnectorSecurityException e) { }
+        try {
+            facade.resolveUsername(ObjectClass.ACCOUNT, \
&quot;hopefully.inexisting.user&quot;, null); +            Assert.fail();
+        } catch (ConnectorSecurityException e) { }
+    }
+
+    @Test
+    public void testAuthenticateExpiredPassword() {
+        LdapConfiguration config = newConfiguration();
+        config.setRespectResourcePasswordPolicyChangeAfterReset(false);
+        ConnectorFacade facade = newFacade(config);
+        facade.authenticate(ObjectClass.ACCOUNT, EXPIRED_UID, new \
GuardedString(&quot;password&quot;.toCharArray()), null); +
+        config = newConfiguration();
+        config.setRespectResourcePasswordPolicyChangeAfterReset(true);
+        facade = newFacade(config);
+        try {
+            facade.authenticate(ObjectClass.ACCOUNT, EXPIRED_UID, new \
GuardedString(&quot;password&quot;.toCharArray()), null); +            Assert.fail();
+        } catch (PasswordExpiredException e) {
+            // OK.
+        }
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapConfigurationTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,337 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import org.testng.Assert;
-import static org.identityconnectors.common.CollectionUtil.newList;
-import java.util.Arrays;
-
-import org.identityconnectors.common.security.GuardedByteArray;
-import org.identityconnectors.framework.common.exceptions.ConfigurationException;
-import org.identityconnectors.test.common.TestHelpers;
-
-public class LdapConfigurationTests {
-
-    private static final String INVALID_DN = &quot;dc=a,,&quot;;
-
-    private LdapConfiguration config;
-
-    @BeforeMethod
-	public void before() throws Exception {
-        config = new LdapConfiguration();
-        config.setConnectorMessages(TestHelpers.createDummyMessages());
-        config.setHost(&quot;localhost&quot;);
-        config.setBaseContexts(&quot;dc=example,dc=com&quot;);
-        assertCanValidate(config);
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsNotEmpty() {
-        config.setBaseContexts();
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsItemNotNull() {
-        config.setBaseContexts((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsItemNotBlank() {
-        config.setBaseContexts(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsValid() {
-        config.setBaseContexts(LdapConnectorTestBase.ACME_DN, INVALID_DN);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordAttributeNotNull() {
-        config.setPasswordAttribute(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordAttributeNotBlank() {
-        config.setPasswordAttribute(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testAccountObjectClassesNotEmpty() {
-        config.setAccountObjectClasses();
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testAccountObjectClassesItemNotNull() {
-        config.setAccountObjectClasses((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testAccountUserNameAttributesNotEmpty() {
-        config.setAccountUserNameAttributes();
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testAccountUserNameAttributesItemNotNull() {
-        config.setAccountUserNameAttributes((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testGroupMemberAttributeNotNull() {
-        config.setGroupMemberAttribute(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testGroupMemberAttributeNotBlank() {
-        config.setGroupMemberAttribute(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBlockCountGreatherThanZero() {
-        config.setBlockSize(0);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testVlvSortAttributeNotNull() {
-        config.setUidAttribute(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testVlvSortAttributeNotBlank() {
-        config.setUidAttribute(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testUidAttributeNotNull() {
-        config.setUidAttribute(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testUidAttributeNotBlank() {
-        config.setUidAttribute(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsToSynchronizeItemNotNull() {
-        config.setBaseContextsToSynchronize((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsToSynchronizeItemNotBlank() {
-        config.setBaseContextsToSynchronize(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testBaseContextsToSyncronizeValid() {
-        config.setBaseContextsToSynchronize(LdapConnectorTestBase.ACME_DN, \
                INVALID_DN);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testObjectClassesToSynchronizeNotEmpty() {
-        config.setObjectClassesToSynchronize();
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testObjectClassesToSynchronizeItemNotNull() {
-        config.setObjectClassesToSynchronize((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testObjectClassesToSynchronizeItemNotBlank() {
-        config.setObjectClassesToSynchronize(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testAttributesToSynchronizeItemNotNull() {
-        config.setAttributesToSynchronize((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testAttributesToSynchronizeItemNotBlank() {
-        config.setAttributesToSynchronize(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testModifiersNamesToFilterOutItemNotNull() {
-        config.setModifiersNamesToFilterOut((String) null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testModifiersNamesToFilterOutItemNotBlank() {
-        config.setModifiersNamesToFilterOut(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testModifiersNamesToFilterOutValid() {
-        config.setModifiersNamesToFilterOut(LdapConnectorTestBase.ACME_DN, \
                INVALID_DN);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testChangeNumberAttributeNotNull() {
-        config.setChangeNumberAttribute(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testChangeNumberAttributeNotBlank() {
-        config.setChangeNumberAttribute(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testChangeLogBlockSizeGreatherThanZero() {
-        config.setChangeLogBlockSize(0);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordAttributeToSynchronizeNotNull() {
-        config.setSynchronizePasswords(true);
-        config.setPasswordAttributeToSynchronize(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordAttributeToSynchronizeNotBlank() {
-        config.setSynchronizePasswords(true);
-        config.setPasswordAttributeToSynchronize(&quot; &quot;);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordDecryptionKeyNotNull() {
-        config.setSynchronizePasswords(true);
-        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
-        config.setPasswordDecryptionKey(null);
-        config.setPasswordDecryptionInitializationVector(new GuardedByteArray(new \
                byte[1]));
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordDecryptionKeyNotBlank() {
-        config.setSynchronizePasswords(true);
-        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
-        config.setPasswordDecryptionKey(new GuardedByteArray(new byte[0]));
-        config.setPasswordDecryptionInitializationVector(new GuardedByteArray(new \
                byte[1]));
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordDecryptionInitializationVectorNotNull() {
-        config.setSynchronizePasswords(true);
-        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
-        config.setPasswordDecryptionKey(new GuardedByteArray(new byte[1]));
-        config.setPasswordDecryptionInitializationVector(null);
-        config.validate();
-    }
-
-    @Test(expectedExceptions = ConfigurationException.class)
-    public void testPasswordDecryptionInitializationVectorNotBlank() {
-        config.setSynchronizePasswords(true);
-        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
-        config.setPasswordDecryptionKey(new GuardedByteArray(new byte[1]));
-        config.setPasswordDecryptionInitializationVector(new GuardedByteArray(new \
                byte[0]));
-        config.validate();
-    }
-
-    @Test
-    public void testDefaultValues() {
-        config = new LdapConfiguration();
-        assertNull(config.getHost());
-        assertEquals(LdapConfiguration.DEFAULT_PORT, config.getPort());
-        assertFalse(config.isSsl());
-        assertEquals(0, config.getFailover().length);
-        assertNull(config.getPrincipal());
-        assertNull(config.getCredentials());
-        assertEquals(0, config.getBaseContexts().length);
-        assertEquals(&quot;userPassword&quot;, config.getPasswordAttribute());
-        assertEquals(newList(&quot;top&quot;, &quot;person&quot;, \
&quot;organizationalPerson&quot;, &quot;inetOrgPerson&quot;), \
                Arrays.asList(config.getAccountObjectClasses()));
-        assertEquals(newList(&quot;uid&quot;, &quot;cn&quot;), \
                Arrays.asList(config.getAccountUserNameAttributes()));
-        assertNull(config.getAccountSearchFilter());
-        assertEquals(&quot;uniqueMember&quot;, config.getGroupMemberAttribute());
-        assertFalse(config.isMaintainLdapGroupMembership());
-        assertFalse(config.isMaintainPosixGroupMembership());
-        assertFalse(config.isRespectResourcePasswordPolicyChangeAfterReset());
-        assertNull(config.getPasswordHashAlgorithm());
-        assertTrue(config.isUseBlocks());
-        assertEquals(100, config.getBlockSize());
-        assertFalse(config.isUsePagedResultControl());
-        assertEquals(&quot;uid&quot;, config.getVlvSortAttribute());
-        assertEquals(&quot;entryUUID&quot;, config.getUidAttribute());
-        assertTrue(config.isReadSchema());
-        assertEquals(0, config.getBaseContextsToSynchronize().length);
-        assertTrue(Arrays.equals(new String[] { &quot;inetOrgPerson&quot; }, \
                config.getObjectClassesToSynchronize()));
-        assertEquals(0, config.getAttributesToSynchronize().length);
-        assertEquals(0, config.getModifiersNamesToFilterOut().length);
-        assertNull(config.getAccountSynchronizationFilter());
-        assertEquals(100, config.getChangeLogBlockSize());
-        assertEquals(&quot;changeNumber&quot;, config.getChangeNumberAttribute());
-        assertFalse(config.isFilterWithOrInsteadOfAnd());
-        assertTrue(config.isRemoveLogEntryObjectClassFromFilter());
-        assertFalse(config.isSynchronizePasswords());
-        assertNull(config.getPasswordAttributeToSynchronize());
-        assertNull(config.getPasswordDecryptionKey());
-        assertNull(config.getPasswordDecryptionInitializationVector());
-    }
-
-    private static void assertCanValidate(LdapConfiguration config) {
-        try {
-            config.validate();
-        } catch (Exception e) {
-            Assert.fail();
-        }
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapConfigur \
ationTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapLdapConfigurationTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConfigurationTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,337 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.Assert;
+import static org.identityconnectors.common.CollectionUtil.newList;
+import java.util.Arrays;
+
+import org.identityconnectors.common.security.GuardedByteArray;
+import org.identityconnectors.framework.common.exceptions.ConfigurationException;
+import org.identityconnectors.test.common.TestHelpers;
+
+public class LdapConfigurationTests {
+
+    private static final String INVALID_DN = &quot;dc=a,,&quot;;
+
+    private LdapConfiguration config;
+
+    @BeforeMethod
+	public void before() throws Exception {
+        config = new LdapConfiguration();
+        config.setConnectorMessages(TestHelpers.createDummyMessages());
+        config.setHost(&quot;localhost&quot;);
+        config.setBaseContexts(&quot;dc=example,dc=com&quot;);
+        assertCanValidate(config);
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsNotEmpty() {
+        config.setBaseContexts();
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsItemNotNull() {
+        config.setBaseContexts((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsItemNotBlank() {
+        config.setBaseContexts(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsValid() {
+        config.setBaseContexts(LdapConnectorTestBase.ACME_DN, INVALID_DN);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordAttributeNotNull() {
+        config.setPasswordAttribute(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordAttributeNotBlank() {
+        config.setPasswordAttribute(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testAccountObjectClassesNotEmpty() {
+        config.setAccountObjectClasses();
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testAccountObjectClassesItemNotNull() {
+        config.setAccountObjectClasses((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testAccountUserNameAttributesNotEmpty() {
+        config.setAccountUserNameAttributes();
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testAccountUserNameAttributesItemNotNull() {
+        config.setAccountUserNameAttributes((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testGroupMemberAttributeNotNull() {
+        config.setGroupMemberAttribute(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testGroupMemberAttributeNotBlank() {
+        config.setGroupMemberAttribute(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBlockCountGreatherThanZero() {
+        config.setBlockSize(0);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testVlvSortAttributeNotNull() {
+        config.setUidAttribute(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testVlvSortAttributeNotBlank() {
+        config.setUidAttribute(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testUidAttributeNotNull() {
+        config.setUidAttribute(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testUidAttributeNotBlank() {
+        config.setUidAttribute(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsToSynchronizeItemNotNull() {
+        config.setBaseContextsToSynchronize((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsToSynchronizeItemNotBlank() {
+        config.setBaseContextsToSynchronize(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testBaseContextsToSyncronizeValid() {
+        config.setBaseContextsToSynchronize(LdapConnectorTestBase.ACME_DN, \
INVALID_DN); +        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testObjectClassesToSynchronizeNotEmpty() {
+        config.setObjectClassesToSynchronize();
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testObjectClassesToSynchronizeItemNotNull() {
+        config.setObjectClassesToSynchronize((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testObjectClassesToSynchronizeItemNotBlank() {
+        config.setObjectClassesToSynchronize(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testAttributesToSynchronizeItemNotNull() {
+        config.setAttributesToSynchronize((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testAttributesToSynchronizeItemNotBlank() {
+        config.setAttributesToSynchronize(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testModifiersNamesToFilterOutItemNotNull() {
+        config.setModifiersNamesToFilterOut((String) null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testModifiersNamesToFilterOutItemNotBlank() {
+        config.setModifiersNamesToFilterOut(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testModifiersNamesToFilterOutValid() {
+        config.setModifiersNamesToFilterOut(LdapConnectorTestBase.ACME_DN, \
INVALID_DN); +        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testChangeNumberAttributeNotNull() {
+        config.setChangeNumberAttribute(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testChangeNumberAttributeNotBlank() {
+        config.setChangeNumberAttribute(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testChangeLogBlockSizeGreatherThanZero() {
+        config.setChangeLogBlockSize(0);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordAttributeToSynchronizeNotNull() {
+        config.setSynchronizePasswords(true);
+        config.setPasswordAttributeToSynchronize(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordAttributeToSynchronizeNotBlank() {
+        config.setSynchronizePasswords(true);
+        config.setPasswordAttributeToSynchronize(&quot; &quot;);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordDecryptionKeyNotNull() {
+        config.setSynchronizePasswords(true);
+        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
+        config.setPasswordDecryptionKey(null);
+        config.setPasswordDecryptionInitializationVector(new GuardedByteArray(new \
byte[1])); +        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordDecryptionKeyNotBlank() {
+        config.setSynchronizePasswords(true);
+        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
+        config.setPasswordDecryptionKey(new GuardedByteArray(new byte[0]));
+        config.setPasswordDecryptionInitializationVector(new GuardedByteArray(new \
byte[1])); +        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordDecryptionInitializationVectorNotNull() {
+        config.setSynchronizePasswords(true);
+        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
+        config.setPasswordDecryptionKey(new GuardedByteArray(new byte[1]));
+        config.setPasswordDecryptionInitializationVector(null);
+        config.validate();
+    }
+
+    @Test(expectedExceptions = ConfigurationException.class)
+    public void testPasswordDecryptionInitializationVectorNotBlank() {
+        config.setSynchronizePasswords(true);
+        config.setPasswordAttributeToSynchronize(&quot;somepassword&quot;);
+        config.setPasswordDecryptionKey(new GuardedByteArray(new byte[1]));
+        config.setPasswordDecryptionInitializationVector(new GuardedByteArray(new \
byte[0])); +        config.validate();
+    }
+
+    @Test
+    public void testDefaultValues() {
+        config = new LdapConfiguration();
+        assertNull(config.getHost());
+        assertEquals(LdapConfiguration.DEFAULT_PORT, config.getPort());
+        assertFalse(config.isSsl());
+        assertEquals(0, config.getFailover().length);
+        assertNull(config.getPrincipal());
+        assertNull(config.getCredentials());
+        assertEquals(0, config.getBaseContexts().length);
+        assertEquals(&quot;userPassword&quot;, config.getPasswordAttribute());
+        assertEquals(newList(&quot;top&quot;, &quot;person&quot;, \
&quot;organizationalPerson&quot;, &quot;inetOrgPerson&quot;), \
Arrays.asList(config.getAccountObjectClasses())); +        \
assertEquals(newList(&quot;uid&quot;, &quot;cn&quot;), \
Arrays.asList(config.getAccountUserNameAttributes())); +        \
assertNull(config.getAccountSearchFilter()); +        \
assertEquals(&quot;uniqueMember&quot;, config.getGroupMemberAttribute()); +        \
assertFalse(config.isMaintainLdapGroupMembership()); +        \
assertFalse(config.isMaintainPosixGroupMembership()); +        \
assertFalse(config.isRespectResourcePasswordPolicyChangeAfterReset()); +        \
assertNull(config.getPasswordHashAlgorithm()); +        \
assertTrue(config.isUseBlocks()); +        assertEquals(100, config.getBlockSize());
+        assertFalse(config.isUsePagedResultControl());
+        assertEquals(&quot;uid&quot;, config.getVlvSortAttribute());
+        assertEquals(&quot;entryUUID&quot;, config.getUidAttribute());
+        assertTrue(config.isReadSchema());
+        assertEquals(0, config.getBaseContextsToSynchronize().length);
+        assertTrue(Arrays.equals(new String[] { &quot;inetOrgPerson&quot; }, \
config.getObjectClassesToSynchronize())); +        assertEquals(0, \
config.getAttributesToSynchronize().length); +        assertEquals(0, \
config.getModifiersNamesToFilterOut().length); +        \
assertNull(config.getAccountSynchronizationFilter()); +        assertEquals(100, \
config.getChangeLogBlockSize()); +        assertEquals(&quot;changeNumber&quot;, \
config.getChangeNumberAttribute()); +        \
assertFalse(config.isFilterWithOrInsteadOfAnd()); +        \
assertTrue(config.isRemoveLogEntryObjectClassFromFilter()); +        \
assertFalse(config.isSynchronizePasswords()); +        \
assertNull(config.getPasswordAttributeToSynchronize()); +        \
assertNull(config.getPasswordDecryptionKey()); +        \
assertNull(config.getPasswordDecryptionInitializationVector()); +    }
+
+    private static void assertCanValidate(LdapConfiguration config) {
+        try {
+            config.validate();
+        } catch (Exception e) {
+            Assert.fail();
+        }
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapConnectionTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,177 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import org.testng.Assert;
-import static org.identityconnectors.ldap.LdapUtil.getStringAttrValue;
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.common.exceptions.ConnectorException;
-import org.identityconnectors.ldap.LdapConstants.ServerType;
-import javax.naming.ldap.PagedResultsControl;
-import org.forgerock.opendj.ldap.controls.VirtualListViewRequestControl;
-
-public class LdapConnectionTests extends LdapConnectorTestBase {
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return false;
-    }
-
-    @Test
-    public void testSSL() throws NamingException {
-        BlindTrustProvider.register();
-        LdapConfiguration config = newConfiguration();
-        config.setSsl(true);
-        config.setPort(SSL_PORT);
-        testConnection(config);
-    }
-
-    @Test
-    public void testFailover() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        config.setHost(&quot;foobarbaz&quot;);
-        config.setPort(65535);
-        try {
-            testConnection(config);
-        } catch (ConnectorException e) {
-            // OK.
-        } catch (NamingException e) {
-            // Should not normally occur.
-            throw e;
-        }
-
-        config = newConfiguration();
-        config.setHost(&quot;foobarbaz&quot;);
-        config.setPort(65535);
-        config.setFailover(&quot;ldap://localhost:&quot; + PORT);
-        testConnection(config);
-    }
-
-    @Test(enabled = false)
-	private void testConnection(LdapConfiguration config) throws NamingException {
-        LdapConnection conn = new LdapConnection(config);
-        Attributes attrs = conn.getInitialContext().getAttributes(BUGS_BUNNY_DN);
-        assertEquals(BUGS_BUNNY_CN, getStringAttrValue(attrs, &quot;cn&quot;));
-    }
-
-    @Test
-    public void testDefaultAuthenticationMethodIsInferred() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        config.setPrincipal(null);
-        LdapConnection conn = new LdapConnection(config);
-        assertEquals(&quot;none&quot;, \
                conn.getInitialContext().getEnvironment().get(Context.SECURITY_AUTHENTICATION));
                
-
-        config = newConfiguration();
-        config.setPrincipal(ADMIN_DN);
-        config.setCredentials(ADMIN_PASSWORD);
-        conn = new LdapConnection(config);
-        assertEquals(&quot;simple&quot;, \
                conn.getInitialContext().getEnvironment().get(Context.SECURITY_AUTHENTICATION));
                
-    }
-
-    @Test
-    public void testTest() {
-        LdapConfiguration config = newConfiguration();
-        config.setPort(4242);
-        LdapConnection conn = new LdapConnection(config);
-        try {
-            conn.test();
-            Assert.fail();
-        } catch (RuntimeException e) {
-            // Expected.
-        }
-
-        config = newConfiguration();
-        config.setHost(&quot;invalid&quot;);
-        conn = new LdapConnection(config);
-        try {
-            conn.test();
-            Assert.fail();
-        } catch (RuntimeException e) {
-            // Expected.
-        }
-
-        config = newConfiguration();
-        config.setPrincipal(&quot;uid=nobody&quot;);
-        conn = new LdapConnection(config);
-        try {
-            conn.test();
-            Assert.fail();
-        } catch (RuntimeException e) {
-            // Expected.
-        }
-
-        config = newConfiguration();
-        config.setCredentials(new GuardedString(&quot;bogus&quot;.toCharArray()));
-        conn = new LdapConnection(config);
-        try {
-            conn.test();
-            Assert.fail();
-        } catch (RuntimeException e) {
-            // Expected.
-        }
-
-        config = newConfiguration();
-        conn = new LdapConnection(config);
-        conn.test();
-    }
-
-    @Test
-    public void testCheckAlive() {
-        // Set readSchema to true since we are calling createNativeSchema() below, \
                and we
-        // want to get the server schema, not the static one.
-        LdapConfiguration config = newConfiguration(true);
-        LdapConnection conn = new LdapConnection(config);
-        conn.checkAlive();
-        // Ensure the connection is really connected to the server.
-        conn.createNativeSchema();
-        conn.checkAlive();
-        stopServer();
-        try {
-            // This should throw RuntimeException.
-            conn.checkAlive();
-            Assert.fail();
-        } catch (RuntimeException e) {
-            // OK.
-        }
-    }
-
-    @Test
-    public void testSupportedControls() {
-        LdapConnection conn = new LdapConnection(newConfiguration());
-        assertTrue(conn.supportsControl(PagedResultsControl.OID));
-        assertTrue(conn.supportsControl(VirtualListViewRequestControl.OID));
-    }
-
-    @Test
-    public void testServerType() {
-        LdapConnection conn = new LdapConnection(newConfiguration());
-        assertEquals(ServerType.OPENDS, conn.getServerType());
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapConnecti \
onTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapLdapConnectionTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectionTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import static org.identityconnectors.ldap.LdapUtil.getStringAttrValue;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
+import org.identityconnectors.ldap.LdapConstants.ServerType;
+import javax.naming.ldap.PagedResultsControl;
+import org.forgerock.opendj.ldap.controls.VirtualListViewRequestControl;
+
+public class LdapConnectionTests extends LdapConnectorTestBase {
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return false;
+    }
+
+    @Test
+    public void testSSL() throws NamingException {
+        BlindTrustProvider.register();
+        LdapConfiguration config = newConfiguration();
+        config.setSsl(true);
+        config.setPort(SSL_PORT);
+        testConnection(config);
+    }
+
+    @Test
+    public void testFailover() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        config.setHost(&quot;foobarbaz&quot;);
+        config.setPort(65535);
+        try {
+            testConnection(config);
+        } catch (ConnectorException e) {
+            // OK.
+        } catch (NamingException e) {
+            // Should not normally occur.
+            throw e;
+        }
+
+        config = newConfiguration();
+        config.setHost(&quot;foobarbaz&quot;);
+        config.setPort(65535);
+        config.setFailover(&quot;ldap://localhost:&quot; + PORT);
+        testConnection(config);
+    }
+
+    @Test(enabled = false)
+	private void testConnection(LdapConfiguration config) throws NamingException {
+        LdapConnection conn = new LdapConnection(config);
+        Attributes attrs = conn.getInitialContext().getAttributes(BUGS_BUNNY_DN);
+        assertEquals(BUGS_BUNNY_CN, getStringAttrValue(attrs, &quot;cn&quot;));
+    }
+
+    @Test
+    public void testDefaultAuthenticationMethodIsInferred() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        config.setPrincipal(null);
+        LdapConnection conn = new LdapConnection(config);
+        assertEquals(&quot;none&quot;, \
conn.getInitialContext().getEnvironment().get(Context.SECURITY_AUTHENTICATION)); +
+        config = newConfiguration();
+        config.setPrincipal(ADMIN_DN);
+        config.setCredentials(ADMIN_PASSWORD);
+        conn = new LdapConnection(config);
+        assertEquals(&quot;simple&quot;, \
conn.getInitialContext().getEnvironment().get(Context.SECURITY_AUTHENTICATION)); +    \
} +
+    @Test
+    public void testTest() {
+        LdapConfiguration config = newConfiguration();
+        config.setPort(4242);
+        LdapConnection conn = new LdapConnection(config);
+        try {
+            conn.test();
+            Assert.fail();
+        } catch (RuntimeException e) {
+            // Expected.
+        }
+
+        config = newConfiguration();
+        config.setHost(&quot;invalid&quot;);
+        conn = new LdapConnection(config);
+        try {
+            conn.test();
+            Assert.fail();
+        } catch (RuntimeException e) {
+            // Expected.
+        }
+
+        config = newConfiguration();
+        config.setPrincipal(&quot;uid=nobody&quot;);
+        conn = new LdapConnection(config);
+        try {
+            conn.test();
+            Assert.fail();
+        } catch (RuntimeException e) {
+            // Expected.
+        }
+
+        config = newConfiguration();
+        config.setCredentials(new GuardedString(&quot;bogus&quot;.toCharArray()));
+        conn = new LdapConnection(config);
+        try {
+            conn.test();
+            Assert.fail();
+        } catch (RuntimeException e) {
+            // Expected.
+        }
+
+        config = newConfiguration();
+        conn = new LdapConnection(config);
+        conn.test();
+    }
+
+    @Test
+    public void testCheckAlive() {
+        // Set readSchema to true since we are calling createNativeSchema() below, \
and we +        // want to get the server schema, not the static one.
+        LdapConfiguration config = newConfiguration(true);
+        LdapConnection conn = new LdapConnection(config);
+        conn.checkAlive();
+        // Ensure the connection is really connected to the server.
+        conn.createNativeSchema();
+        conn.checkAlive();
+        stopServer();
+        try {
+            // This should throw RuntimeException.
+            conn.checkAlive();
+            Assert.fail();
+        } catch (RuntimeException e) {
+            // OK.
+        }
+    }
+
+    @Test
+    public void testSupportedControls() {
+        LdapConnection conn = new LdapConnection(newConfiguration());
+        assertTrue(conn.supportsControl(PagedResultsControl.OID));
+        assertTrue(conn.supportsControl(VirtualListViewRequestControl.OID));
+    }
+
+    @Test
+    public void testServerType() {
+        LdapConnection conn = new LdapConnection(newConfiguration());
+        assertEquals(ServerType.OPENDS, conn.getServerType());
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapConnectorTestBasejava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,271 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.Assert;
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.List;
-
-import org.identityconnectors.common.IOUtil;
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.api.APIConfiguration;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.api.ConnectorFacadeFactory;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
-import org.identityconnectors.test.common.TestHelpers;
-import org.opends.server.config.ConfigException;
-import org.opends.server.types.DirectoryEnvironmentConfig;
-import org.opends.server.types.InitializationException;
-import org.opends.server.util.EmbeddedUtils;
-
-public abstract class LdapConnectorTestBase {
-
-    // Cf. data.ldif and bigcompany.ldif.
-
-    public static final int PORT = 2389;
-    public static final int SSL_PORT = 2636;
-
-    public static final String EXAMPLE_COM_DN = &quot;dc=example,dc=com&quot;;
-
-    public static final String ADMIN_DN = &quot;uid=admin,dc=example,dc=com&quot;;
-    public static final GuardedString ADMIN_PASSWORD = new \
                GuardedString(&quot;password&quot;.toCharArray());
-
-    public static final String ACME_DN = &quot;o=Acme,dc=example,dc=com&quot;;
-    public static final String ACME_O = &quot;Acme&quot;;
-
-    public static final String CZECH_REPUBLIC_DN = &quot;c=Czech \
                Republic,o=Acme,dc=example,dc=com&quot;;
-    public static final String CZECH_REPUBLIC_C = &quot;Czech Republic&quot;;
-
-    public static final String ACME_USERS_DN = \
                &quot;ou=Users,o=Acme,dc=example,dc=com&quot;;
-
-    public static final String BUGS_BUNNY_DN = \
                &quot;uid=bugs.bunny,ou=Users,o=Acme,dc=example,dc=com&quot;;
-    public static final String BUGS_BUNNY_UID = &quot;bugs.bunny&quot;;
-    public static final String BBUNNY_UID = &quot;bbunny&quot;;
-    public static final String BUGS_BUNNY_CN = &quot;Bugs Bunny&quot;;
-    public static final String BUGS_BUNNY_SN = &quot;Bunny&quot;;
-    public static final String ELMER_FUDD_DN = \
                &quot;uid=elmer.fudd,ou=Users,o=Acme,dc=example,dc=com&quot;;
-    public static final String ELMER_FUDD_UID = &quot;elmer.fudd&quot;;
-    public static final String SYLVESTER_DN = \
                &quot;uid=sylvester,ou=Users,o=Acme,dc=example,dc=com&quot;;
-    public static final String SYLVESTER_UID = &quot;sylvester&quot;;
-    public static final String EXPIRED_UID = &quot;expired&quot;;
-
-    public static final String BUGS_AND_FRIENDS_DN = &quot;cn=Bugs and \
                Friends,o=Acme,dc=example,dc=com&quot;;
-    public static final String EXTERNAL_PEERS_DN = &quot;cn=External \
                Peers,o=Acme,dc=example,dc=com&quot;;
-
-    public static final String UNIQUE_BUGS_AND_FRIENDS_DN = &quot;cn=Unique Bugs and \
                Friends,o=Acme,dc=example,dc=com&quot;;
-    public static final String UNIQUE_BUGS_AND_FRIENDS_CN = &quot;Unique Bugs and \
                Friends&quot;;
-    public static final String UNIQUE_EXTERNAL_PEERS_DN = &quot;cn=Unique External \
                Peers,o=Acme,dc=example,dc=com&quot;;
-    public static final String UNIQUE_EMPTY_GROUP_DN = &quot;cn=Unique Empty \
                Group,o=Acme,dc=example,dc=com&quot;;
-
-    public static final String POSIX_BUGS_AND_FRIENDS_DN = &quot;cn=POSIX Bugs and \
                Friends,o=Acme,dc=example,dc=com&quot;;
-    public static final String POSIX_EXTERNAL_PEERS_DN = &quot;cn=POSIX External \
                Peers,o=Acme,dc=example,dc=com&quot;;
-    public static final String POSIX_EMPTY_GROUP_DN = &quot;cn=POSIX Empty \
                Group,o=Acme,dc=example,dc=com&quot;;
-    public static final String POSIX_BUGS_BUNNY_GROUP = &quot;cn=POSIX Bugs Bunny \
                Group,o=Acme,dc=example,dc=com&quot;;
-
-    public static final String SMALL_COMPANY_DN = &quot;o=Small \
                Company,dc=example,dc=com&quot;;
-    public static final String SMALL_COMPANY_O = &quot;Small Company&quot;;
-    public static final String SINGLE_ACCOUNT_DN = &quot;uid=single.account,o=Small \
                Company,dc=example,dc=com&quot;;
-    public static final String SINGLE_ACCOUNT_UID = &quot;single.account&quot;;
-    public static final String OWNER_DN = &quot;cn=Owner,o=Small \
                Company,dc=example,dc=com&quot;;
-
-    public static final String BIG_COMPANY_DN = &quot;o=Big \
                Company,dc=example,dc=com&quot;;
-    public static final String BIG_COMPANY_O = &quot;Big Company&quot;;
-    public static final String USER_0_DN = &quot;uid=user.0,ou=People,o=Big \
                Company,dc=example,dc=com&quot;;
-    public static final String USER_0_UID = &quot;user.0&quot;;
-    public static final String USER_0_CN = &quot;Aaccf Amar&quot;;
-    public static final String USER_0_SN = &quot;Amar&quot;;
-    public static final String USER_0_GIVEN_NAME = &quot;Aaccf&quot;;
-
-    // Cf. test/opends/config/config.ldif and setup-test-opends.xml.
-
-    private static final String[] FILES = {
-        &quot;config/config.ldif&quot;,
-        &quot;config/admin-backend.ldif&quot;,
-        &quot;config/keystore&quot;,
-        &quot;config/keystore.pin&quot;,
-        &quot;config/schema/00-core.ldif&quot;,
-        &quot;config/schema/01-pwpolicy.ldif&quot;,
-        &quot;config/schema/02-config.ldif&quot;,
-        &quot;config/schema/03-changelog.ldif&quot;,
-        &quot;config/schema/03-rfc2713.ldif&quot;,
-        &quot;config/schema/03-rfc2714.ldif&quot;,
-        &quot;config/schema/03-rfc2739.ldif&quot;,
-        &quot;config/schema/03-rfc2926.ldif&quot;,
-        &quot;config/schema/03-rfc3112.ldif&quot;,
-        &quot;config/schema/03-rfc3712.ldif&quot;,
-        &quot;config/schema/03-uddiv3.ldif&quot;,
-        &quot;config/schema/04-rfc2307bis.ldif&quot;,
-        &quot;db/userRoot/00000000.jdb&quot;
-    };
-
-    @AfterClass
-    public static void afterClass() {
-        if (EmbeddedUtils.isRunning()) {
-            stopServer();
-        }
-    }
-
-    @BeforeMethod
-	public void before() throws Exception {
-        if (!EmbeddedUtils.isRunning()) {
-            startServer();
-        }
-    }
-
-    @AfterMethod
-	public void after() throws Exception {
-        if (restartServerAfterEachTest()) {
-            stopServer();
-        }
-    }
-
-    protected abstract boolean restartServerAfterEachTest();
-
-    public static LdapConfiguration newConfiguration() {
-        // IdM will not read the schema, so prefer to test with that setting.
-        return newConfiguration(false);
-    }
-
-    public static LdapConfiguration newConfiguration(boolean readSchema) {
-        LdapConfiguration config = new LdapConfiguration();
-        // Cf. opends/config.ldif.
-        config.setHost(&quot;localhost&quot;);
-        config.setPort(PORT);
-        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
-        config.setPrincipal(ADMIN_DN);
-        config.setCredentials(ADMIN_PASSWORD);
-        config.setReadSchema(readSchema);
-        return config;
-    }
-
-    public static ConnectorFacade newFacade() {
-        return newFacade(newConfiguration());
-    }
-
-    public static ConnectorFacade newFacade(LdapConfiguration cfg) {
-        ConnectorFacadeFactory factory = ConnectorFacadeFactory.getInstance();
-        APIConfiguration impl = \
                TestHelpers.createTestConfiguration(LdapConnector.class, cfg);
-        return factory.newInstance(impl);
-    }
-
-    public static ConnectorObject searchByAttribute(ConnectorFacade facade, \
                ObjectClass oclass, Attribute attr) {
-        return searchByAttribute(facade, oclass, attr, (OperationOptions) null);
-    }
-
-    public static ConnectorObject searchByAttribute(ConnectorFacade facade, \
                ObjectClass oclass, Attribute attr, String... attributesToGet) {
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(attributesToGet);
-        return searchByAttribute(facade, oclass, attr, builder.build());
-    }
-
-    public static ConnectorObject searchByAttribute(ConnectorFacade facade, \
                ObjectClass oclass, Attribute attr, OperationOptions options) {
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                oclass, FilterBuilder.equalTo(attr), options);
-        return objects.size() &gt; 0 ? objects.get(0) : null;
-    }
-
-    public static ConnectorObject findByAttribute(List&lt;ConnectorObject&gt; \
                objects, String attrName, Object value) {
-        for (ConnectorObject object : objects) {
-            Attribute attr = object.getAttributeByName(attrName);
-            if (attr != null) {
-                Object attrValue = AttributeUtil.getSingleValue(attr);
-                if (value.equals(attrValue)) {
-                    return object;
-                }
-            }
-        }
-        return null;
-    }
-
-    protected void startServer() throws IOException {
-        File root = new File(System.getProperty(&quot;java.io.tmpdir&quot;), \
                &quot;opends&quot;);
-        IOUtil.delete(root);
-        if (!root.mkdirs()) {
-            throw new IOException();
-        }
-        for (String path : FILES) {
-            File file = new File(root, path);
-            File parent = file.getParentFile();
-            if (!parent.exists() &amp;&amp; !parent.mkdirs()) {
-                throw new IOException(file.getAbsolutePath());
-            }
-            IOUtil.extractResourceToFile(LdapConnectorTestBase.class, \
                &quot;opends/&quot; + path, file);
-        }
-
-        File configDir = new File(root, &quot;config&quot;);
-        File configFile = new File(configDir, &quot;config.ldif&quot;);
-        File schemaDir = new File(configDir, &quot;schema&quot;);
-        File lockDir = new File(root, &quot;locks&quot;);
-        if (!lockDir.mkdirs()) {
-            throw new IOException();
-        }
-
-        try {
-            DirectoryEnvironmentConfig config = new DirectoryEnvironmentConfig();
-            config.setServerRoot(root);
-            config.setConfigFile(configFile);
-            config.setSchemaDirectory(schemaDir);
-            config.setLockDirectory(lockDir);
-            EmbeddedUtils.startServer(config);
-        } catch (ConfigException e) {
-            throw (IOException) new IOException(e.getMessage()).initCause(e);
-        } catch (InitializationException e) {
-            throw (IOException) new IOException(e.getMessage()).initCause(e);
-        }
-    }
-
-    protected static void stopServer() {
-        EmbeddedUtils.stopServer(&quot;org.test.opends.EmbeddedOpenDS&quot;, null);
-        // It seems that EmbeddedUtils.stopServer() returns before the server has \
                stopped listening on its port,
-        // causing the next test to fail when starting the server.
-        final int WAIT = 200; // ms
-        final int ITERATIONS = 25;
-        for (int i = 1; ; i++) {
-            try {
-                new Socket(InetAddress.getLocalHost(), PORT).close();
-            } catch (IOException e) {
-                // Okay, server has stopped.
-                return;
-            }
-            if (i &lt; ITERATIONS) {
-                try {
-                    Thread.sleep(WAIT);
-                } catch (InterruptedException e) {}
-            } else {
-                break;
-            }
-        }
-        Assert.fail(&quot;OpenDS failed to stop&quot;);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapConnecto \
rTestBasejavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapLdapConnectorTestBasejava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapConnectorTestBase.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,271 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.Assert;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.util.List;
+
+import org.identityconnectors.common.IOUtil;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.api.APIConfiguration;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.api.ConnectorFacadeFactory;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
+import org.identityconnectors.test.common.TestHelpers;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.DirectoryEnvironmentConfig;
+import org.opends.server.types.InitializationException;
+import org.opends.server.util.EmbeddedUtils;
+
+public abstract class LdapConnectorTestBase {
+
+    // Cf. data.ldif and bigcompany.ldif.
+
+    public static final int PORT = 2389;
+    public static final int SSL_PORT = 2636;
+
+    public static final String EXAMPLE_COM_DN = &quot;dc=example,dc=com&quot;;
+
+    public static final String ADMIN_DN = &quot;uid=admin,dc=example,dc=com&quot;;
+    public static final GuardedString ADMIN_PASSWORD = new \
GuardedString(&quot;password&quot;.toCharArray()); +
+    public static final String ACME_DN = &quot;o=Acme,dc=example,dc=com&quot;;
+    public static final String ACME_O = &quot;Acme&quot;;
+
+    public static final String CZECH_REPUBLIC_DN = &quot;c=Czech \
Republic,o=Acme,dc=example,dc=com&quot;; +    public static final String \
CZECH_REPUBLIC_C = &quot;Czech Republic&quot;; +
+    public static final String ACME_USERS_DN = \
&quot;ou=Users,o=Acme,dc=example,dc=com&quot;; +
+    public static final String BUGS_BUNNY_DN = \
&quot;uid=bugs.bunny,ou=Users,o=Acme,dc=example,dc=com&quot;; +    public static \
final String BUGS_BUNNY_UID = &quot;bugs.bunny&quot;; +    public static final String \
BBUNNY_UID = &quot;bbunny&quot;; +    public static final String BUGS_BUNNY_CN = \
&quot;Bugs Bunny&quot;; +    public static final String BUGS_BUNNY_SN = \
&quot;Bunny&quot;; +    public static final String ELMER_FUDD_DN = \
&quot;uid=elmer.fudd,ou=Users,o=Acme,dc=example,dc=com&quot;; +    public static \
final String ELMER_FUDD_UID = &quot;elmer.fudd&quot;; +    public static final String \
SYLVESTER_DN = &quot;uid=sylvester,ou=Users,o=Acme,dc=example,dc=com&quot;; +    \
public static final String SYLVESTER_UID = &quot;sylvester&quot;; +    public static \
final String EXPIRED_UID = &quot;expired&quot;; +
+    public static final String BUGS_AND_FRIENDS_DN = &quot;cn=Bugs and \
Friends,o=Acme,dc=example,dc=com&quot;; +    public static final String \
EXTERNAL_PEERS_DN = &quot;cn=External Peers,o=Acme,dc=example,dc=com&quot;; +
+    public static final String UNIQUE_BUGS_AND_FRIENDS_DN = &quot;cn=Unique Bugs and \
Friends,o=Acme,dc=example,dc=com&quot;; +    public static final String \
UNIQUE_BUGS_AND_FRIENDS_CN = &quot;Unique Bugs and Friends&quot;; +    public static \
final String UNIQUE_EXTERNAL_PEERS_DN = &quot;cn=Unique External \
Peers,o=Acme,dc=example,dc=com&quot;; +    public static final String \
UNIQUE_EMPTY_GROUP_DN = &quot;cn=Unique Empty Group,o=Acme,dc=example,dc=com&quot;; +
+    public static final String POSIX_BUGS_AND_FRIENDS_DN = &quot;cn=POSIX Bugs and \
Friends,o=Acme,dc=example,dc=com&quot;; +    public static final String \
POSIX_EXTERNAL_PEERS_DN = &quot;cn=POSIX External \
Peers,o=Acme,dc=example,dc=com&quot;; +    public static final String \
POSIX_EMPTY_GROUP_DN = &quot;cn=POSIX Empty Group,o=Acme,dc=example,dc=com&quot;; +   \
public static final String POSIX_BUGS_BUNNY_GROUP = &quot;cn=POSIX Bugs Bunny \
Group,o=Acme,dc=example,dc=com&quot;; +
+    public static final String SMALL_COMPANY_DN = &quot;o=Small \
Company,dc=example,dc=com&quot;; +    public static final String SMALL_COMPANY_O = \
&quot;Small Company&quot;; +    public static final String SINGLE_ACCOUNT_DN = \
&quot;uid=single.account,o=Small Company,dc=example,dc=com&quot;; +    public static \
final String SINGLE_ACCOUNT_UID = &quot;single.account&quot;; +    public static \
final String OWNER_DN = &quot;cn=Owner,o=Small Company,dc=example,dc=com&quot;; +
+    public static final String BIG_COMPANY_DN = &quot;o=Big \
Company,dc=example,dc=com&quot;; +    public static final String BIG_COMPANY_O = \
&quot;Big Company&quot;; +    public static final String USER_0_DN = \
&quot;uid=user.0,ou=People,o=Big Company,dc=example,dc=com&quot;; +    public static \
final String USER_0_UID = &quot;user.0&quot;; +    public static final String \
USER_0_CN = &quot;Aaccf Amar&quot;; +    public static final String USER_0_SN = \
&quot;Amar&quot;; +    public static final String USER_0_GIVEN_NAME = \
&quot;Aaccf&quot;; +
+    // Cf. test/opends/config/config.ldif and setup-test-opends.xml.
+
+    private static final String[] FILES = {
+        &quot;config/config.ldif&quot;,
+        &quot;config/admin-backend.ldif&quot;,
+        &quot;config/keystore&quot;,
+        &quot;config/keystore.pin&quot;,
+        &quot;config/schema/00-core.ldif&quot;,
+        &quot;config/schema/01-pwpolicy.ldif&quot;,
+        &quot;config/schema/02-config.ldif&quot;,
+        &quot;config/schema/03-changelog.ldif&quot;,
+        &quot;config/schema/03-rfc2713.ldif&quot;,
+        &quot;config/schema/03-rfc2714.ldif&quot;,
+        &quot;config/schema/03-rfc2739.ldif&quot;,
+        &quot;config/schema/03-rfc2926.ldif&quot;,
+        &quot;config/schema/03-rfc3112.ldif&quot;,
+        &quot;config/schema/03-rfc3712.ldif&quot;,
+        &quot;config/schema/03-uddiv3.ldif&quot;,
+        &quot;config/schema/04-rfc2307bis.ldif&quot;,
+        &quot;db/userRoot/00000000.jdb&quot;
+    };
+
+    @AfterClass
+    public static void afterClass() {
+        if (EmbeddedUtils.isRunning()) {
+            stopServer();
+        }
+    }
+
+    @BeforeMethod
+	public void before() throws Exception {
+        if (!EmbeddedUtils.isRunning()) {
+            startServer();
+        }
+    }
+
+    @AfterMethod
+	public void after() throws Exception {
+        if (restartServerAfterEachTest()) {
+            stopServer();
+        }
+    }
+
+    protected abstract boolean restartServerAfterEachTest();
+
+    public static LdapConfiguration newConfiguration() {
+        // IdM will not read the schema, so prefer to test with that setting.
+        return newConfiguration(false);
+    }
+
+    public static LdapConfiguration newConfiguration(boolean readSchema) {
+        LdapConfiguration config = new LdapConfiguration();
+        // Cf. opends/config.ldif.
+        config.setHost(&quot;localhost&quot;);
+        config.setPort(PORT);
+        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
+        config.setPrincipal(ADMIN_DN);
+        config.setCredentials(ADMIN_PASSWORD);
+        config.setReadSchema(readSchema);
+        return config;
+    }
+
+    public static ConnectorFacade newFacade() {
+        return newFacade(newConfiguration());
+    }
+
+    public static ConnectorFacade newFacade(LdapConfiguration cfg) {
+        ConnectorFacadeFactory factory = ConnectorFacadeFactory.getInstance();
+        APIConfiguration impl = \
TestHelpers.createTestConfiguration(LdapConnector.class, cfg); +        return \
factory.newInstance(impl); +    }
+
+    public static ConnectorObject searchByAttribute(ConnectorFacade facade, \
ObjectClass oclass, Attribute attr) { +        return searchByAttribute(facade, \
oclass, attr, (OperationOptions) null); +    }
+
+    public static ConnectorObject searchByAttribute(ConnectorFacade facade, \
ObjectClass oclass, Attribute attr, String... attributesToGet) { +        \
OperationOptionsBuilder builder = new OperationOptionsBuilder(); +        \
builder.setAttributesToGet(attributesToGet); +        return \
searchByAttribute(facade, oclass, attr, builder.build()); +    }
+
+    public static ConnectorObject searchByAttribute(ConnectorFacade facade, \
ObjectClass oclass, Attribute attr, OperationOptions options) { +        \
List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, oclass, \
FilterBuilder.equalTo(attr), options); +        return objects.size() &gt; 0 ? \
objects.get(0) : null; +    }
+
+    public static ConnectorObject findByAttribute(List&lt;ConnectorObject&gt; \
objects, String attrName, Object value) { +        for (ConnectorObject object : \
objects) { +            Attribute attr = object.getAttributeByName(attrName);
+            if (attr != null) {
+                Object attrValue = AttributeUtil.getSingleValue(attr);
+                if (value.equals(attrValue)) {
+                    return object;
+                }
+            }
+        }
+        return null;
+    }
+
+    protected void startServer() throws IOException {
+        File root = new File(System.getProperty(&quot;java.io.tmpdir&quot;), \
&quot;opends&quot;); +        IOUtil.delete(root);
+        if (!root.mkdirs()) {
+            throw new IOException();
+        }
+        for (String path : FILES) {
+            File file = new File(root, path);
+            File parent = file.getParentFile();
+            if (!parent.exists() &amp;&amp; !parent.mkdirs()) {
+                throw new IOException(file.getAbsolutePath());
+            }
+            IOUtil.extractResourceToFile(LdapConnectorTestBase.class, \
&quot;opends/&quot; + path, file); +        }
+
+        File configDir = new File(root, &quot;config&quot;);
+        File configFile = new File(configDir, &quot;config.ldif&quot;);
+        File schemaDir = new File(configDir, &quot;schema&quot;);
+        File lockDir = new File(root, &quot;locks&quot;);
+        if (!lockDir.mkdirs()) {
+            throw new IOException();
+        }
+
+        try {
+            DirectoryEnvironmentConfig config = new DirectoryEnvironmentConfig();
+            config.setServerRoot(root);
+            config.setConfigFile(configFile);
+            config.setSchemaDirectory(schemaDir);
+            config.setLockDirectory(lockDir);
+            EmbeddedUtils.startServer(config);
+        } catch (ConfigException e) {
+            throw (IOException) new IOException(e.getMessage()).initCause(e);
+        } catch (InitializationException e) {
+            throw (IOException) new IOException(e.getMessage()).initCause(e);
+        }
+    }
+
+    protected static void stopServer() {
+        EmbeddedUtils.stopServer(&quot;org.test.opends.EmbeddedOpenDS&quot;, null);
+        // It seems that EmbeddedUtils.stopServer() returns before the server has \
stopped listening on its port, +        // causing the next test to fail when \
starting the server. +        final int WAIT = 200; // ms
+        final int ITERATIONS = 25;
+        for (int i = 1; ; i++) {
+            try {
+                new Socket(InetAddress.getLocalHost(), PORT).close();
+            } catch (IOException e) {
+                // Okay, server has stopped.
+                return;
+            }
+            if (i &lt; ITERATIONS) {
+                try {
+                    Thread.sleep(WAIT);
+                } catch (InterruptedException e) {}
+            } else {
+                break;
+            }
+        }
+        Assert.fail(&quot;OpenDS failed to stop&quot;);
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapEntryTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import static org.testng.AssertJUnit.assertEquals;
-import org.testng.annotations.Test;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-
-public class LdapEntryTests {
-
-    @Test
-    public void testEntryDNAttribute() throws Exception {
-        final String NAME = &quot;uid=admin&quot;;
-        final String BASE = &quot;dc=example,dc=com&quot;;
-        final String ENTRY_DN = NAME + &quot;,&quot; + BASE;
-        final String OTHER_ENTRY_DN = &quot;uid=nothing,dc=example,dc=com&quot;;
-
-        BasicAttributes attrs = new BasicAttributes(false);
-        attrs.put(new BasicAttribute(&quot;entryDN&quot;, OTHER_ENTRY_DN));
-        attrs.put(new BasicAttribute(&quot;cn&quot;, &quot;Common Name&quot;));
-        LdapEntry entry = LdapEntry.create(NAME + &quot;,&quot; + BASE, attrs);
-
-        assertEquals(&quot;Common Name&quot;, \
                entry.getAttributes().get(&quot;cn&quot;).get());
-        assertEquals(ENTRY_DN, entry.getAttributes().get(&quot;dn&quot;).get());
-        assertEquals(ENTRY_DN, \
                entry.getAttributes().get(&quot;entryDN&quot;).get());
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapLdapEntryTes \
tsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapLdapEntryTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/LdapEntryTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.Test;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+public class LdapEntryTests {
+
+    @Test
+    public void testEntryDNAttribute() throws Exception {
+        final String NAME = &quot;uid=admin&quot;;
+        final String BASE = &quot;dc=example,dc=com&quot;;
+        final String ENTRY_DN = NAME + &quot;,&quot; + BASE;
+        final String OTHER_ENTRY_DN = &quot;uid=nothing,dc=example,dc=com&quot;;
+
+        BasicAttributes attrs = new BasicAttributes(false);
+        attrs.put(new BasicAttribute(&quot;entryDN&quot;, OTHER_ENTRY_DN));
+        attrs.put(new BasicAttribute(&quot;cn&quot;, &quot;Common Name&quot;));
+        LdapEntry entry = LdapEntry.create(NAME + &quot;,&quot; + BASE, attrs);
+
+        assertEquals(&quot;Common Name&quot;, \
entry.getAttributes().get(&quot;cn&quot;).get()); +        assertEquals(ENTRY_DN, \
entry.getAttributes().get(&quot;dn&quot;).get()); +        assertEquals(ENTRY_DN, \
entry.getAttributes().get(&quot;entryDN&quot;).get()); +    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapSunDSTestBasejava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,89 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap;
-
-import static java.util.Collections.reverse;
-import static java.util.Collections.sort;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.LdapName;
-
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.api.APIConfiguration;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.api.ConnectorFacadeFactory;
-import org.identityconnectors.ldap.search.DefaultSearchStrategy;
-import org.identityconnectors.ldap.search.LdapInternalSearch;
-import org.identityconnectors.ldap.search.LdapSearchResultsHandler;
-import org.identityconnectors.test.common.PropertyBag;
-import org.identityconnectors.test.common.TestHelpers;
-
-public class SunDSTestBase {
-
-    public static LdapConfiguration newConfiguration() {
-        LdapConfiguration config = new LdapConfiguration();
-        config.setConnectorMessages(TestHelpers.createDummyMessages());
-        PropertyBag testProps = TestHelpers.getProperties(LdapConnector.class);
-        config.setHost(testProps.getStringProperty(&quot;sunds.host&quot;));
-        config.setPort(testProps.getProperty(&quot;sunds.port&quot;, Integer.class, \
                389));
-        config.setPrincipal(testProps.getStringProperty(&quot;sunds.principal&quot;));
                
-        config.setCredentials(testProps.getProperty(&quot;sunds.credentials&quot;, \
                GuardedString.class));
-        config.setBaseContexts(testProps.getStringProperty(&quot;sunds.baseContext&quot;));
                
-        config.setUidAttribute(&quot;entryDN&quot;);
-        config.setReadSchema(false); // To be compatible with IdM.
-        config.validate();
-        return config;
-    }
-
-    public static void cleanupBaseContext(LdapConnection conn) throws \
                NamingException {
-        SearchControls controls = LdapInternalSearch.createDefaultSearchControls();
-        controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-        LdapInternalSearch search = new LdapInternalSearch(conn, null, \
                Arrays.asList(conn.getConfiguration().getBaseContexts()),
-                new DefaultSearchStrategy(false), controls);
-        final List&lt;LdapName&gt; entryDNs = new ArrayList&lt;LdapName&gt;();
-        search.execute(new LdapSearchResultsHandler() {
-            public boolean handle(String baseDN, SearchResult result) throws \
                NamingException {
-                entryDNs.add(LdapEntry.create(baseDN, result).getDN());
-                return true;
-            }
-        });
-        entryDNs.removeAll(conn.getConfiguration().getBaseContextsAsLdapNames());
-        sort(entryDNs);
-        reverse(entryDNs); // Cf. LdapName.compareTo().
-        for (LdapName entryDN : entryDNs) {
-            conn.getInitialContext().destroySubcontext(entryDN);
-        }
-    }
-
-    public static ConnectorFacade newFacade(LdapConfiguration cfg) {
-        ConnectorFacadeFactory factory = ConnectorFacadeFactory.getInstance();
-        APIConfiguration impl = \
                TestHelpers.createTestConfiguration(LdapConnector.class, cfg);
-        return factory.newInstance(impl);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapSunDSTestBas \
ejavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapSunDSTestBasejava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/SunDSTestBase.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap;
+
+import static java.util.Collections.reverse;
+import static java.util.Collections.sort;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.LdapName;
+
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.api.APIConfiguration;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.api.ConnectorFacadeFactory;
+import org.identityconnectors.ldap.search.DefaultSearchStrategy;
+import org.identityconnectors.ldap.search.LdapInternalSearch;
+import org.identityconnectors.ldap.search.LdapSearchResultsHandler;
+import org.identityconnectors.test.common.PropertyBag;
+import org.identityconnectors.test.common.TestHelpers;
+
+public class SunDSTestBase {
+
+    public static LdapConfiguration newConfiguration() {
+        LdapConfiguration config = new LdapConfiguration();
+        config.setConnectorMessages(TestHelpers.createDummyMessages());
+        PropertyBag testProps = TestHelpers.getProperties(LdapConnector.class);
+        config.setHost(testProps.getStringProperty(&quot;sunds.host&quot;));
+        config.setPort(testProps.getProperty(&quot;sunds.port&quot;, Integer.class, \
389)); +        config.setPrincipal(testProps.getStringProperty(&quot;sunds.principal&quot;));
 +        config.setCredentials(testProps.getProperty(&quot;sunds.credentials&quot;, \
GuardedString.class)); +        \
config.setBaseContexts(testProps.getStringProperty(&quot;sunds.baseContext&quot;)); + \
config.setUidAttribute(&quot;entryDN&quot;); +        config.setReadSchema(false); // \
To be compatible with IdM. +        config.validate();
+        return config;
+    }
+
+    public static void cleanupBaseContext(LdapConnection conn) throws \
NamingException { +        SearchControls controls = \
LdapInternalSearch.createDefaultSearchControls(); +        \
controls.setSearchScope(SearchControls.SUBTREE_SCOPE); +        LdapInternalSearch \
search = new LdapInternalSearch(conn, null, \
Arrays.asList(conn.getConfiguration().getBaseContexts()), +                new \
DefaultSearchStrategy(false), controls); +        final List&lt;LdapName&gt; entryDNs \
= new ArrayList&lt;LdapName&gt;(); +        search.execute(new \
LdapSearchResultsHandler() { +            public boolean handle(String baseDN, \
SearchResult result) throws NamingException { +                \
entryDNs.add(LdapEntry.create(baseDN, result).getDN()); +                return true;
+            }
+        });
+        entryDNs.removeAll(conn.getConfiguration().getBaseContextsAsLdapNames());
+        sort(entryDNs);
+        reverse(entryDNs); // Cf. LdapName.compareTo().
+        for (LdapName entryDN : entryDNs) {
+            conn.getInitialContext().destroySubcontext(entryDN);
+        }
+    }
+
+    public static ConnectorFacade newFacade(LdapConfiguration cfg) {
+        ConnectorFacadeFactory factory = ConnectorFacadeFactory.getInstance();
+        APIConfiguration impl = \
TestHelpers.createTestConfiguration(LdapConnector.class, cfg); +        return \
factory.newInstance(impl); +    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodifyLdapCreateTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,230 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.modify;
-
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.identityconnectors.common.IOUtil;
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.identityconnectors.ldap.LdapConfiguration;
-import org.identityconnectors.ldap.LdapConnectorTestBase;
-
-public class LdapCreateTests extends LdapConnectorTestBase{
-
-    // TODO test that we can create an entry of an object class not in the schema.
-    // TODO test that we can't create an entry outside the configured base DNs.
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return true;
-    }
-
-    @Test
-    public void testCreateAccount() {
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateAccount(facade);
-    }
-
-    @Test
-    public void testCreateAccountWhenReadingSchema() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.isReadSchema());
-        config.setReadSchema(true);
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        config.setAccountObjectClasses(&quot;inetOrgPerson&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateAccount(facade);
-    }
-
-    @Test
-    public void testCreateAccountWhenUidNotDefault() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
-        config.setUidAttribute(&quot;entryDN&quot;);
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateAccount(facade);
-    }
-
-    private void doCreateAccount(ConnectorFacade facade) {
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        Name name = new Name(&quot;uid=another.worker,&quot; + SMALL_COMPANY_DN);
-        attributes.add(name);
-        attributes.add(AttributeBuilder.build(&quot;uid&quot;, \
                &quot;another.worker&quot;));
-        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Another \
                Worker&quot;));
-        attributes.add(AttributeBuilder.build(&quot;givenName&quot;, \
                &quot;Another&quot;));
-        attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Worker&quot;));
-        Uid uid = facade.create(ObjectClass.ACCOUNT, attributes, null);
-
-        ConnectorObject newAccount = facade.getObject(ObjectClass.ACCOUNT, uid, \
                null);
-        assertEquals(name, newAccount.getName());
-    }
-
-    @Test
-    public void testCreateGroup() {
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateGroup(facade);
-    }
-
-    @Test
-    public void testCreateGroupWhenReadingSchema() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.isReadSchema());
-        config.setReadSchema(true);
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        config.setAccountObjectClasses(&quot;inetOrgPerson&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateGroup(facade);
-    }
-
-    @Test
-    public void testCreateGroupWhenUidNotDefault() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
-        config.setUidAttribute(&quot;entryDN&quot;);
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateGroup(facade);
-    }
-
-    private void doCreateGroup(ConnectorFacade facade) {
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        Name name = new Name(&quot;cn=Another Group,&quot; + SMALL_COMPANY_DN);
-        attributes.add(name);
-        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Another \
                Group&quot;));
-        Uid uid = facade.create(ObjectClass.GROUP, attributes, null);
-
-        ConnectorObject newGroup = facade.getObject(ObjectClass.GROUP, uid, null);
-        assertEquals(name, newGroup.getName());
-    }
-
-    @Test
-    public void testCreateArbitrary() {
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateArbitrary(facade);
-    }
-
-    @Test
-    public void testCreateArbitraryWhenReadingSchema() {
-        LdapConfiguration config = newConfiguration(true);
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateArbitrary(facade);
-    }
-
-    @Test
-    public void testCreateArbitraryWhenUidNotDefault() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
-        config.setUidAttribute(&quot;entryDN&quot;);
-        config.setBaseContexts(SMALL_COMPANY_DN);
-        ConnectorFacade facade = newFacade(config);
-
-        doCreateArbitrary(facade);
-    }
-
-    private void doCreateArbitrary(ConnectorFacade facade) {
-        // Let the arbitrary object class be organization.
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        Name name = new Name(&quot;o=Smallest,&quot; + SMALL_COMPANY_DN);
-        attributes.add(name);
-        attributes.add(AttributeBuilder.build(&quot;o&quot;, &quot;Smallest&quot;));
-        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
-        Uid uid = facade.create(oclass, attributes, null);
-
-        ConnectorObject newObject = facade.getObject(oclass, uid, null);
-        assertEquals(name, newObject.getName());
-    }
-
-    @Test
-    public void testCreateBinaryAttributes() throws IOException {
-        ConnectorFacade facade = newFacade();
-
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        attributes.add(new \
                Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;));
-        attributes.add(AttributeBuilder.build(&quot;uid&quot;, \
                &quot;daffy.duck&quot;));
-        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Daffy \
                Duck&quot;));
-        attributes.add(AttributeBuilder.build(&quot;givenName&quot;, \
                &quot;Daffy&quot;));
-        attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Duck&quot;));
-        byte[] certificate = IOUtil.getResourceAsBytes(LdapCreateTests.class, \
                &quot;certificate.cert&quot;);
-        attributes.add(AttributeBuilder.build(&quot;userCertificate&quot;, \
                certificate));
-        byte[] photo = IOUtil.getResourceAsBytes(LdapCreateTests.class, \
                &quot;photo.jpg&quot;);
-        attributes.add(AttributeBuilder.build(&quot;jpegPhoto&quot;, photo));
-        Uid uid = facade.create(ObjectClass.ACCOUNT, attributes, null);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;userCertificate&quot;, \
                &quot;jpegPhoto&quot;);
-
-        ConnectorObject newAccount = facade.getObject(ObjectClass.ACCOUNT, uid, \
                builder.build());
-        byte[] storedCertificate = (byte[]) \
                newAccount.getAttributeByName(&quot;userCertificate&quot;).getValue().get(0);
                
-        assertTrue(Arrays.equals(certificate, storedCertificate));
-        byte[] storedPhoto = (byte[]) \
                newAccount.getAttributeByName(&quot;jpegPhoto&quot;).getValue().get(0);
                
-        assertTrue(Arrays.equals(photo, storedPhoto));
-    }
-
-    @Test
-    public void testCreatePassword() {
-        ConnectorFacade facade = newFacade();
-
-        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
-        attributes.add(new \
                Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;));
-        attributes.add(AttributeBuilder.build(&quot;uid&quot;, \
                &quot;daffy.duck&quot;));
-        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Daffy \
                Duck&quot;));
-        attributes.add(AttributeBuilder.build(&quot;givenName&quot;, \
                &quot;Daffy&quot;));
-        attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Duck&quot;));
-        GuardedString password = new \
                GuardedString(&quot;I.hate.rabbits&quot;.toCharArray());
-        attributes.add(AttributeBuilder.buildPassword(password));
-        facade.create(ObjectClass.ACCOUNT, attributes, null);
-
-        facade.authenticate(ObjectClass.ACCOUNT, &quot;daffy.duck&quot;, password, \
                null);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodifyLdapCr \
eateTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapmodifyLdapCreateTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapCreateTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,230 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.modify;
+
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.identityconnectors.common.IOUtil;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.identityconnectors.ldap.LdapConfiguration;
+import org.identityconnectors.ldap.LdapConnectorTestBase;
+
+public class LdapCreateTests extends LdapConnectorTestBase{
+
+    // TODO test that we can create an entry of an object class not in the schema.
+    // TODO test that we can't create an entry outside the configured base DNs.
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return true;
+    }
+
+    @Test
+    public void testCreateAccount() {
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateAccount(facade);
+    }
+
+    @Test
+    public void testCreateAccountWhenReadingSchema() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.isReadSchema());
+        config.setReadSchema(true);
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        config.setAccountObjectClasses(&quot;inetOrgPerson&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateAccount(facade);
+    }
+
+    @Test
+    public void testCreateAccountWhenUidNotDefault() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
+        config.setUidAttribute(&quot;entryDN&quot;);
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateAccount(facade);
+    }
+
+    private void doCreateAccount(ConnectorFacade facade) {
+        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
+        Name name = new Name(&quot;uid=another.worker,&quot; + SMALL_COMPANY_DN);
+        attributes.add(name);
+        attributes.add(AttributeBuilder.build(&quot;uid&quot;, \
&quot;another.worker&quot;)); +        \
attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Another Worker&quot;)); + \
attributes.add(AttributeBuilder.build(&quot;givenName&quot;, &quot;Another&quot;)); + \
attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Worker&quot;)); +        \
Uid uid = facade.create(ObjectClass.ACCOUNT, attributes, null); +
+        ConnectorObject newAccount = facade.getObject(ObjectClass.ACCOUNT, uid, \
null); +        assertEquals(name, newAccount.getName());
+    }
+
+    @Test
+    public void testCreateGroup() {
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateGroup(facade);
+    }
+
+    @Test
+    public void testCreateGroupWhenReadingSchema() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.isReadSchema());
+        config.setReadSchema(true);
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        config.setAccountObjectClasses(&quot;inetOrgPerson&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateGroup(facade);
+    }
+
+    @Test
+    public void testCreateGroupWhenUidNotDefault() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
+        config.setUidAttribute(&quot;entryDN&quot;);
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateGroup(facade);
+    }
+
+    private void doCreateGroup(ConnectorFacade facade) {
+        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
+        Name name = new Name(&quot;cn=Another Group,&quot; + SMALL_COMPANY_DN);
+        attributes.add(name);
+        attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Another \
Group&quot;)); +        Uid uid = facade.create(ObjectClass.GROUP, attributes, null);
+
+        ConnectorObject newGroup = facade.getObject(ObjectClass.GROUP, uid, null);
+        assertEquals(name, newGroup.getName());
+    }
+
+    @Test
+    public void testCreateArbitrary() {
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateArbitrary(facade);
+    }
+
+    @Test
+    public void testCreateArbitraryWhenReadingSchema() {
+        LdapConfiguration config = newConfiguration(true);
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateArbitrary(facade);
+    }
+
+    @Test
+    public void testCreateArbitraryWhenUidNotDefault() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
+        config.setUidAttribute(&quot;entryDN&quot;);
+        config.setBaseContexts(SMALL_COMPANY_DN);
+        ConnectorFacade facade = newFacade(config);
+
+        doCreateArbitrary(facade);
+    }
+
+    private void doCreateArbitrary(ConnectorFacade facade) {
+        // Let the arbitrary object class be organization.
+        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
+        Name name = new Name(&quot;o=Smallest,&quot; + SMALL_COMPANY_DN);
+        attributes.add(name);
+        attributes.add(AttributeBuilder.build(&quot;o&quot;, &quot;Smallest&quot;));
+        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
+        Uid uid = facade.create(oclass, attributes, null);
+
+        ConnectorObject newObject = facade.getObject(oclass, uid, null);
+        assertEquals(name, newObject.getName());
+    }
+
+    @Test
+    public void testCreateBinaryAttributes() throws IOException {
+        ConnectorFacade facade = newFacade();
+
+        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
+        attributes.add(new \
Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;)); +        \
attributes.add(AttributeBuilder.build(&quot;uid&quot;, &quot;daffy.duck&quot;)); +    \
attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Daffy Duck&quot;)); +     \
attributes.add(AttributeBuilder.build(&quot;givenName&quot;, &quot;Daffy&quot;)); +   \
attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Duck&quot;)); +        \
byte[] certificate = IOUtil.getResourceAsBytes(LdapCreateTests.class, \
&quot;certificate.cert&quot;); +        \
attributes.add(AttributeBuilder.build(&quot;userCertificate&quot;, certificate)); +   \
byte[] photo = IOUtil.getResourceAsBytes(LdapCreateTests.class, \
&quot;photo.jpg&quot;); +        \
attributes.add(AttributeBuilder.build(&quot;jpegPhoto&quot;, photo)); +        Uid \
uid = facade.create(ObjectClass.ACCOUNT, attributes, null); +
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;userCertificate&quot;, \
&quot;jpegPhoto&quot;); +
+        ConnectorObject newAccount = facade.getObject(ObjectClass.ACCOUNT, uid, \
builder.build()); +        byte[] storedCertificate = (byte[]) \
newAccount.getAttributeByName(&quot;userCertificate&quot;).getValue().get(0); +       \
assertTrue(Arrays.equals(certificate, storedCertificate)); +        byte[] \
storedPhoto = (byte[]) \
newAccount.getAttributeByName(&quot;jpegPhoto&quot;).getValue().get(0); +        \
assertTrue(Arrays.equals(photo, storedPhoto)); +    }
+
+    @Test
+    public void testCreatePassword() {
+        ConnectorFacade facade = newFacade();
+
+        Set&lt;Attribute&gt; attributes = new HashSet&lt;Attribute&gt;();
+        attributes.add(new \
Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;)); +        \
attributes.add(AttributeBuilder.build(&quot;uid&quot;, &quot;daffy.duck&quot;)); +    \
attributes.add(AttributeBuilder.build(&quot;cn&quot;, &quot;Daffy Duck&quot;)); +     \
attributes.add(AttributeBuilder.build(&quot;givenName&quot;, &quot;Daffy&quot;)); +   \
attributes.add(AttributeBuilder.build(&quot;sn&quot;, &quot;Duck&quot;)); +        \
GuardedString password = new GuardedString(&quot;I.hate.rabbits&quot;.toCharArray()); \
+        attributes.add(AttributeBuilder.buildPassword(password)); +        \
facade.create(ObjectClass.ACCOUNT, attributes, null); +
+        facade.authenticate(ObjectClass.ACCOUNT, &quot;daffy.duck&quot;, password, \
null); +    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodifyLdapDeleteTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,68 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.modify;
-
-import static org.testng.AssertJUnit.assertNull;
-import org.testng.annotations.Test;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.common.exceptions.ConnectorException;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.ldap.LdapConnectorTestBase;
-
-public class LdapDeleteTests extends LdapConnectorTestBase{
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return false;
-    }
-
-    @Test(expectedExceptions = ConnectorException.class)
-    public void testCannotDeleteExistingUidButWrongObjectClass() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject organization = searchByAttribute(facade, new \
                ObjectClass(&quot;organization&quot;), new Name(BIG_COMPANY_DN));
-        // Should fail because the object class passed to delete() is not \
                ORGANIZATION.
-        facade.delete(ObjectClass.ACCOUNT, organization.getUid(), null);
-    }
-
-    @Test(expectedExceptions = ConnectorException.class)
-    public void testCannotDeleteNonEmptyDN() {
-        // TODO: not sure this is the right behavior. Perhaps should instead
-        // recursively delete everything under the deleted entry.
-        ConnectorFacade facade = newFacade();
-        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
-        ConnectorObject organization = searchByAttribute(facade, oclass, new \
                Name(ACME_DN));
-        facade.delete(oclass, organization.getUid(), null);
-    }
-
-    @Test()
-    public void testDelete() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject account = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        facade.delete(ObjectClass.ACCOUNT, account.getUid(), null);
-
-        account = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        assertNull(account);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodifyLdapDe \
leteTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapmodifyLdapDeleteTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapDeleteTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.modify;
+
+import static org.testng.AssertJUnit.assertNull;
+import org.testng.annotations.Test;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.ldap.LdapConnectorTestBase;
+
+public class LdapDeleteTests extends LdapConnectorTestBase{
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return false;
+    }
+
+    @Test(expectedExceptions = ConnectorException.class)
+    public void testCannotDeleteExistingUidButWrongObjectClass() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject organization = searchByAttribute(facade, new \
ObjectClass(&quot;organization&quot;), new Name(BIG_COMPANY_DN)); +        // Should \
fail because the object class passed to delete() is not ORGANIZATION. +        \
facade.delete(ObjectClass.ACCOUNT, organization.getUid(), null); +    }
+
+    @Test(expectedExceptions = ConnectorException.class)
+    public void testCannotDeleteNonEmptyDN() {
+        // TODO: not sure this is the right behavior. Perhaps should instead
+        // recursively delete everything under the deleted entry.
+        ConnectorFacade facade = newFacade();
+        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
+        ConnectorObject organization = searchByAttribute(facade, oclass, new \
Name(ACME_DN)); +        facade.delete(oclass, organization.getUid(), null);
+    }
+
+    @Test()
+    public void testDelete() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject account = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        facade.delete(ObjectClass.ACCOUNT, account.getUid(), \
null); +
+        account = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        assertNull(account);
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodifyLdapUpdateTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,211 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.modify;
-
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import static java.util.Collections.singleton;
-import static org.identityconnectors.common.CollectionUtil.newSet;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-
-import org.identityconnectors.common.IOUtil;
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.identityconnectors.ldap.LdapConfiguration;
-import org.identityconnectors.ldap.LdapConnectorTestBase;
-import org.identityconnectors.test.common.TestHelpers;
-
-public class LdapUpdateTests extends LdapConnectorTestBase {
-
-    // XXX need tests for the case when the one of the modified (or removed)
-    // attribute is the Name or especially Uid.
-
-    private static final String NUMBER1 = &quot;+1 800 123 4567&quot;;
-    private static final String NUMBER2 = &quot;+1 800 765 4321&quot;;
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return true;
-    }
-
-    @Test
-    public void testSimpleAddRemoveAttrs() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        Attribute number1 = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
                NUMBER1);
-
-        Uid newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, bugs.getUid(), \
                singleton(number1), null);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;telephoneNumber&quot;);
-        OperationOptions options = builder.build();
-
-        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, options);
-        List&lt;Object&gt; numberAttr = \
                bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue();
-        assertEquals(NUMBER1, numberAttr.get(0));
-        assertEquals(1, numberAttr.size());
-
-        Attribute number2 = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
                NUMBER2);
-        newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, bugs.getUid(), \
                singleton(number2), null);
-
-        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, options);
-        numberAttr = \
                bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue();
-        assertEquals(NUMBER1, numberAttr.get(0));
-        assertEquals(NUMBER2, numberAttr.get(1));
-        assertEquals(2, numberAttr.size());
-
-        newUid = facade.removeAttributeValues(ObjectClass.ACCOUNT, bugs.getUid(), \
                newSet(number1, number2), null);
-
-        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, options);
-        assertTrue(bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue().isEmpty());
                
-    }
-
-    @Test
-    public void testRename() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        Name name = new \
                Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;);
-        Attribute number = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
                NUMBER1);
-        Uid newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), newSet(name, \
                number), null);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;telephoneNumber&quot;);
-
-        ConnectorObject daffy = facade.getObject(ObjectClass.ACCOUNT, newUid, \
                builder.build());
-        assertEquals(name, daffy.getName());
-        assertEquals(NUMBER1, \
                daffy.getAttributeByName(&quot;telephoneNumber&quot;).getValue().get(0));
                
-    }
-
-    @Test
-    public void testRenameWhenUidNotDefault() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
-        config.setUidAttribute(&quot;entryDN&quot;);
-        ConnectorFacade facade = newFacade(config);
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        Name name = new \
                Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;);
-        Uid newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), \
                singleton((Attribute) name), null);
-
-        assertEquals(name.getNameValue(), newUid.getUidValue()); // Since they are \
                both the entry DN.
-        ConnectorObject daffy = facade.getObject(ObjectClass.ACCOUNT, newUid, null);
-        assertEquals(name, daffy.getName());
-    }
-
-    @Test
-    public void testEmptyAttributeValueRemovesAttribute() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        Attribute number = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
                NUMBER1);
-        Uid newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), \
                singleton(number), null);
-
-        Attribute noNumber = AttributeBuilder.build(&quot;telephoneNumber&quot;);
-        assertNull(noNumber.getValue());
-        newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), \
                singleton(noNumber), null);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;telephoneNumber&quot;);
-
-        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, builder.build());
-        assertTrue(bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue().isEmpty());
                
-    }
-
-    @Test
-    public void testUpdateBinaryAttributes() throws IOException {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        byte[] certificate = IOUtil.getResourceAsBytes(LdapUpdateTests.class, \
                &quot;certificate.cert&quot;);
-        Attribute certAttr = AttributeBuilder.build(&quot;userCertificate&quot;, \
                certificate);
-        Uid newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), \
                singleton(certAttr), null);
-
-        byte[] photo = IOUtil.getResourceAsBytes(LdapUpdateTests.class, \
                &quot;photo.jpg&quot;);
-        Attribute photoAttr = AttributeBuilder.build(&quot;jpegPhoto&quot;, photo);
-        newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, newUid, \
                singleton(photoAttr), null);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;userCertificate&quot;, \
                &quot;jpegPhoto&quot;);
-
-        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, builder.build());
-        byte[] storedCertificate = (byte[]) \
                bugs.getAttributeByName(&quot;userCertificate&quot;).getValue().get(0);
                
-        assertTrue(Arrays.equals(certificate, storedCertificate));
-        byte[] storedPhoto = (byte[]) \
                bugs.getAttributeByName(&quot;jpegPhoto&quot;).getValue().get(0);
-        assertTrue(Arrays.equals(photo, storedPhoto));
-    }
-
-    @Test
-    public void testAdminCanChangePassword() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject elmer = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(ELMER_FUDD_DN));
-
-        GuardedString password = new \
                GuardedString(&quot;shotgun&quot;.toCharArray());
-        Attribute pwdAttr = AttributeBuilder.buildPassword(password);
-        facade.update(ObjectClass.ACCOUNT, elmer.getUid(), singleton(pwdAttr), \
                null);
-
-        // Now test that the user can login with the new password and execute an \
                operation.
-        LdapConfiguration config = newConfiguration();
-        config.setPrincipal(ELMER_FUDD_DN);
-        config.setCredentials(password);
-        config.setUseBlocks(false); // Do not use block (paged, VLV) search, since \
                the user doesn't have the privilege.
-        facade = newFacade(config);
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, new \
                ObjectClass(&quot;organization&quot;), null);
-        assertNotNull(findByAttribute(objects, Name.NAME, ACME_DN));
-    }
-
-    @Test
-    public void testUserCanChangePassword() {
-        LdapConfiguration config = newConfiguration();
-        config.setPrincipal(BUGS_BUNNY_DN);
-        config.setCredentials(new GuardedString(&quot;carrot&quot;.toCharArray()));
-        config.setUseBlocks(false); // Do not use paged search, since the user \
                doesn't have the privilege.
-        ConnectorFacade facade = newFacade(config);
-        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        GuardedString password = new \
                GuardedString(&quot;cabbage&quot;.toCharArray());
-        Attribute pwdAttr = AttributeBuilder.buildPassword(password);
-        facade.update(ObjectClass.ACCOUNT, bugs.getUid(), singleton(pwdAttr), null);
-
-        // Now test that the user can login with the new password and execute an \
                operation.
-        config.setCredentials(password);
-        facade = newFacade(config);
-        ConnectorObject elmer = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(ELMER_FUDD_DN));
-        assertNotNull(elmer);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapmodifyLdapUp \
dateTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapmodifyLdapUpdateTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/modify/LdapUpdateTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,211 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.modify;
+
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import static java.util.Collections.singleton;
+import static org.identityconnectors.common.CollectionUtil.newSet;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.identityconnectors.common.IOUtil;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.identityconnectors.ldap.LdapConfiguration;
+import org.identityconnectors.ldap.LdapConnectorTestBase;
+import org.identityconnectors.test.common.TestHelpers;
+
+public class LdapUpdateTests extends LdapConnectorTestBase {
+
+    // XXX need tests for the case when the one of the modified (or removed)
+    // attribute is the Name or especially Uid.
+
+    private static final String NUMBER1 = &quot;+1 800 123 4567&quot;;
+    private static final String NUMBER2 = &quot;+1 800 765 4321&quot;;
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return true;
+    }
+
+    @Test
+    public void testSimpleAddRemoveAttrs() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        Attribute number1 = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
NUMBER1); +
+        Uid newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, bugs.getUid(), \
singleton(number1), null); +
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;telephoneNumber&quot;);
+        OperationOptions options = builder.build();
+
+        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, options);
+        List&lt;Object&gt; numberAttr = \
bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue(); +        \
assertEquals(NUMBER1, numberAttr.get(0)); +        assertEquals(1, \
numberAttr.size()); +
+        Attribute number2 = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
NUMBER2); +        newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, \
bugs.getUid(), singleton(number2), null); +
+        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, options);
+        numberAttr = \
bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue(); +        \
assertEquals(NUMBER1, numberAttr.get(0)); +        assertEquals(NUMBER2, \
numberAttr.get(1)); +        assertEquals(2, numberAttr.size());
+
+        newUid = facade.removeAttributeValues(ObjectClass.ACCOUNT, bugs.getUid(), \
newSet(number1, number2), null); +
+        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, options);
+        assertTrue(bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue().isEmpty());
 +    }
+
+    @Test
+    public void testRename() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        Name name = new \
Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;); +        \
Attribute number = AttributeBuilder.build(&quot;telephoneNumber&quot;, NUMBER1); +    \
Uid newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), newSet(name, number), \
null); +
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;telephoneNumber&quot;);
+
+        ConnectorObject daffy = facade.getObject(ObjectClass.ACCOUNT, newUid, \
builder.build()); +        assertEquals(name, daffy.getName());
+        assertEquals(NUMBER1, \
daffy.getAttributeByName(&quot;telephoneNumber&quot;).getValue().get(0)); +    }
+
+    @Test
+    public void testRenameWhenUidNotDefault() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
+        config.setUidAttribute(&quot;entryDN&quot;);
+        ConnectorFacade facade = newFacade(config);
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        Name name = new \
Name(&quot;uid=daffy.duck,ou=Users,o=Acme,dc=example,dc=com&quot;); +        Uid \
newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), singleton((Attribute) \
name), null); +
+        assertEquals(name.getNameValue(), newUid.getUidValue()); // Since they are \
both the entry DN. +        ConnectorObject daffy = \
facade.getObject(ObjectClass.ACCOUNT, newUid, null); +        assertEquals(name, \
daffy.getName()); +    }
+
+    @Test
+    public void testEmptyAttributeValueRemovesAttribute() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        Attribute number = AttributeBuilder.build(&quot;telephoneNumber&quot;, \
NUMBER1); +        Uid newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), \
singleton(number), null); +
+        Attribute noNumber = AttributeBuilder.build(&quot;telephoneNumber&quot;);
+        assertNull(noNumber.getValue());
+        newUid = facade.update(ObjectClass.ACCOUNT, bugs.getUid(), \
singleton(noNumber), null); +
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;telephoneNumber&quot;);
+
+        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, builder.build());
+        assertTrue(bugs.getAttributeByName(&quot;telephoneNumber&quot;).getValue().isEmpty());
 +    }
+
+    @Test
+    public void testUpdateBinaryAttributes() throws IOException {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        byte[] certificate = IOUtil.getResourceAsBytes(LdapUpdateTests.class, \
&quot;certificate.cert&quot;); +        Attribute certAttr = \
AttributeBuilder.build(&quot;userCertificate&quot;, certificate); +        Uid newUid \
= facade.update(ObjectClass.ACCOUNT, bugs.getUid(), singleton(certAttr), null); +
+        byte[] photo = IOUtil.getResourceAsBytes(LdapUpdateTests.class, \
&quot;photo.jpg&quot;); +        Attribute photoAttr = \
AttributeBuilder.build(&quot;jpegPhoto&quot;, photo); +        newUid = \
facade.addAttributeValues(ObjectClass.ACCOUNT, newUid, singleton(photoAttr), null); +
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;userCertificate&quot;, \
&quot;jpegPhoto&quot;); +
+        bugs = facade.getObject(ObjectClass.ACCOUNT, newUid, builder.build());
+        byte[] storedCertificate = (byte[]) \
bugs.getAttributeByName(&quot;userCertificate&quot;).getValue().get(0); +        \
assertTrue(Arrays.equals(certificate, storedCertificate)); +        byte[] \
storedPhoto = (byte[]) \
bugs.getAttributeByName(&quot;jpegPhoto&quot;).getValue().get(0); +        \
assertTrue(Arrays.equals(photo, storedPhoto)); +    }
+
+    @Test
+    public void testAdminCanChangePassword() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject elmer = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(ELMER_FUDD_DN)); +
+        GuardedString password = new \
GuardedString(&quot;shotgun&quot;.toCharArray()); +        Attribute pwdAttr = \
AttributeBuilder.buildPassword(password); +        facade.update(ObjectClass.ACCOUNT, \
elmer.getUid(), singleton(pwdAttr), null); +
+        // Now test that the user can login with the new password and execute an \
operation. +        LdapConfiguration config = newConfiguration();
+        config.setPrincipal(ELMER_FUDD_DN);
+        config.setCredentials(password);
+        config.setUseBlocks(false); // Do not use block (paged, VLV) search, since \
the user doesn't have the privilege. +        facade = newFacade(config);
+        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, new \
ObjectClass(&quot;organization&quot;), null); +        \
assertNotNull(findByAttribute(objects, Name.NAME, ACME_DN)); +    }
+
+    @Test
+    public void testUserCanChangePassword() {
+        LdapConfiguration config = newConfiguration();
+        config.setPrincipal(BUGS_BUNNY_DN);
+        config.setCredentials(new GuardedString(&quot;carrot&quot;.toCharArray()));
+        config.setUseBlocks(false); // Do not use paged search, since the user \
doesn't have the privilege. +        ConnectorFacade facade = newFacade(config);
+        ConnectorObject bugs = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        GuardedString password = new \
GuardedString(&quot;cabbage&quot;.toCharArray()); +        Attribute pwdAttr = \
AttributeBuilder.buildPassword(password); +        facade.update(ObjectClass.ACCOUNT, \
bugs.getUid(), singleton(pwdAttr), null); +
+        // Now test that the user can login with the new password and execute an \
operation. +        config.setCredentials(password);
+        facade = newFacade(config);
+        ConnectorObject elmer = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(ELMER_FUDD_DN)); +        assertNotNull(elmer);
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapschemaGuardedPasswordAttributeTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,73 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.schema;
-
-import static org.testng.AssertJUnit.assertEquals;
-import org.testng.annotations.Test;
-import java.io.UnsupportedEncodingException;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.ldap.schema.GuardedPasswordAttribute.Accessor;
-
-public class GuardedPasswordAttributeTests {
-
-    @Test
-    public void testAccess() throws NamingException {
-        final String PASSWORD = \
&quot;\u011b\u0161\u010d\u0159\u017e\u00fd\u00e1\u00ed\u00e9&quot;; // Czech \
                characters ;-)
-
-        GuardedPasswordAttribute pwdAttr = \
GuardedPasswordAttribute.create(&quot;userPassword&quot;, new \
                GuardedString(PASSWORD.toCharArray()));
-        final Attribute[] attribute = { null };
-
-        pwdAttr.access(new Accessor() {
-            public void access(Attribute passwordAttribute) {
-                assertEquals(&quot;userPassword&quot;, passwordAttribute.getID());
-                try {
-                    assertEquals(PASSWORD, new String((byte[]) \
                passwordAttribute.get(), &quot;UTF-8&quot;));
-                } catch (UnsupportedEncodingException e) {
-                    throw new RuntimeException(e);
-                } catch (NamingException e) {
-                    throw new RuntimeException(e);
-                }
-                attribute[0] = passwordAttribute;
-            }
-        });
-        assertEquals(1, attribute[0].size());
-        byte[] value = (byte[]) attribute[0].get();
-        for (int i = 0; i &lt; value.length; i++) {
-            assertEquals((byte) 0, value[i]);
-        }
-    }
-    
-    @Test
-    public void testEmpty() {
-        GuardedPasswordAttribute pwdAttr = \
                GuardedPasswordAttribute.create(&quot;userPassword&quot;);
-        pwdAttr.access(new Accessor() {
-            public void access(Attribute passwordAttribute) {
-                assertEquals(0, passwordAttribute.size());
-            }
-        });
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapschemaGuarde \
dPasswordAttributeTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapschemaGuardedPasswordAttributeTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/GuardedPasswordAttributeTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.schema;
+
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.Test;
+import java.io.UnsupportedEncodingException;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.ldap.schema.GuardedPasswordAttribute.Accessor;
+
+public class GuardedPasswordAttributeTests {
+
+    @Test
+    public void testAccess() throws NamingException {
+        final String PASSWORD = \
&quot;\u011b\u0161\u010d\u0159\u017e\u00fd\u00e1\u00ed\u00e9&quot;; // Czech \
characters ;-) +
+        GuardedPasswordAttribute pwdAttr = \
GuardedPasswordAttribute.create(&quot;userPassword&quot;, new \
GuardedString(PASSWORD.toCharArray())); +        final Attribute[] attribute = { null \
}; +
+        pwdAttr.access(new Accessor() {
+            public void access(Attribute passwordAttribute) {
+                assertEquals(&quot;userPassword&quot;, passwordAttribute.getID());
+                try {
+                    assertEquals(PASSWORD, new String((byte[]) \
passwordAttribute.get(), &quot;UTF-8&quot;)); +                } catch \
(UnsupportedEncodingException e) { +                    throw new \
RuntimeException(e); +                } catch (NamingException e) {
+                    throw new RuntimeException(e);
+                }
+                attribute[0] = passwordAttribute;
+            }
+        });
+        assertEquals(1, attribute[0].size());
+        byte[] value = (byte[]) attribute[0].get();
+        for (int i = 0; i &lt; value.length; i++) {
+            assertEquals((byte) 0, value[i]);
+        }
+    }
+    
+    @Test
+    public void testEmpty() {
+        GuardedPasswordAttribute pwdAttr = \
GuardedPasswordAttribute.create(&quot;userPassword&quot;); +        \
pwdAttr.access(new Accessor() { +            public void access(Attribute \
passwordAttribute) { +                assertEquals(0, passwordAttribute.size());
+            }
+        });
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapschemaLdapSchemaMappingTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,175 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.schema;
-
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import java.util.EnumSet;
-import java.util.Set;
-
-import org.identityconnectors.framework.api.operations.AuthenticationApiOp;
-import org.identityconnectors.framework.api.operations.SyncApiOp;
-import org.identityconnectors.framework.common.objects.AttributeInfo;
-import org.identityconnectors.framework.common.objects.AttributeInfoBuilder;
-import org.identityconnectors.framework.common.objects.AttributeInfoUtil;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.ObjectClassInfo;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.identityconnectors.framework.common.objects.Schema;
-import org.identityconnectors.framework.common.objects.AttributeInfo.Flags;
-import org.identityconnectors.ldap.LdapConfiguration;
-import org.identityconnectors.ldap.LdapConnection;
-import org.identityconnectors.ldap.LdapConnectorTestBase;
-import org.identityconnectors.ldap.LdapConstants;
-import org.identityconnectors.ldap.LdapConstants.ServerType;
-
-public class LdapSchemaMappingTests extends LdapConnectorTestBase {
-
-    // TODO operational attributes.
-    // TODO test for operation option infos.
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return false;
-    }
-
-    @Test
-    public void testObjectClassAttrIsReadOnly() {
-        LdapConfiguration config = newConfiguration(true);
-        Schema schema = newFacade(config).schema();
-        for (ObjectClassInfo oci : schema.getObjectClassInfo()) {
-            AttributeInfo attrInfo = AttributeInfoUtil.find(&quot;objectClass&quot;, \
                oci.getAttributeInfo());
-            assertFalse(attrInfo.isRequired());
-            assertFalse(attrInfo.isCreateable());
-            assertFalse(attrInfo.isUpdateable());
-        }
-    }
-
-    @Test
-    public void testAccountSchema() {
-        LdapConfiguration config = newConfiguration(true);
-        Schema schema = newFacade(config).schema();
-
-        ObjectClassInfo oci = schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME);
-        assertFalse(oci.isContainer());
-
-        // Check some, but not all, attributes of inetOrgClass.
-        Set&lt;AttributeInfo&gt; attrInfos = oci.getAttributeInfo();
-        AttributeInfo info = AttributeInfoUtil.find(&quot;cn&quot;, attrInfos);
-        assertEquals(AttributeInfoBuilder.build(&quot;cn&quot;, String.class, \
                EnumSet.of(Flags.REQUIRED, Flags.MULTIVALUED)), info);
-        info = AttributeInfoUtil.find(&quot;uid&quot;, attrInfos);
-        assertEquals(AttributeInfoBuilder.build(&quot;uid&quot;, String.class, \
                EnumSet.of(Flags.MULTIVALUED)), info);
-        info = AttributeInfoUtil.find(&quot;givenName&quot;, attrInfos);
-        assertEquals(AttributeInfoBuilder.build(&quot;givenName&quot;, String.class, \
                EnumSet.of(Flags.MULTIVALUED)), info);
-        info = AttributeInfoUtil.find(&quot;sn&quot;, attrInfos);
-        assertEquals(AttributeInfoBuilder.build(&quot;sn&quot;, String.class, \
                EnumSet.of(Flags.REQUIRED, Flags.MULTIVALUED)), info);
-
-        // Operational attributes.
-        info = AttributeInfoUtil.find(OperationalAttributes.PASSWORD_NAME, \
                attrInfos);
-        assertEquals(LdapConstants.PASSWORD, info);
-    }
-
-    @Test
-    public void testGroupSchema() {
-        LdapConfiguration config = newConfiguration(true);
-        Schema schema = newFacade(config).schema();
-
-        ObjectClassInfo oci = schema.findObjectClassInfo(ObjectClass.GROUP_NAME);
-        assertFalse(oci.isContainer());
-
-        Set&lt;AttributeInfo&gt; attrInfos = oci.getAttributeInfo();
-
-        AttributeInfo info = AttributeInfoUtil.find(&quot;cn&quot;, attrInfos);
-        assertEquals(AttributeInfoBuilder.build(&quot;cn&quot;, String.class, \
                EnumSet.of(Flags.REQUIRED, Flags.MULTIVALUED)), info);
-    }
-
-    @Test
-    public void testAuthenticationOnlyForAccounts() {
-        LdapConfiguration config = newConfiguration(true);
-        Schema schema = newFacade(config).schema();
-        Set&lt;ObjectClassInfo&gt; ocis = \
                schema.getSupportedObjectClassesByOperation().get(AuthenticationApiOp.class);
                
-        assertEquals(1, ocis.size());
-        assertTrue(ocis.iterator().next().is(ObjectClass.ACCOUNT_NAME));
-    }
-
-    @Test
-    public void testAllObjectClassesInSchema() {
-        Schema schema = newFacade(newConfiguration(true)).schema();
-        // Well, at least some of the most well-known.
-        assertNotNull(schema.findObjectClassInfo(&quot;organization&quot;));
-        assertNotNull(schema.findObjectClassInfo(&quot;groupOfNames&quot;));
-        assertNotNull(schema.findObjectClassInfo(&quot;dNSDomain&quot;));
-        // top is abstract, so it shouldn't be in the schema.
-        assertNull(schema.findObjectClassInfo(&quot;top&quot;));
-        // extensibleObject is auxiliary, so it shouldn't be in the schema.
-        assertNull(schema.findObjectClassInfo(&quot;extensibleObject&quot;));
-    }
-
-    @Test
-    public void testArbitraryObjectClass() {
-        Schema schema = newFacade(newConfiguration(true)).schema();
-
-        ObjectClassInfo dnsDomainInfo = \
                schema.findObjectClassInfo(&quot;dNSDomain&quot;);
-        assertTrue(dnsDomainInfo.isContainer());
-
-        Set&lt;AttributeInfo&gt; dnsDomainAttrInfos = dnsDomainInfo \
                .getAttributeInfo();
-        // Inherited from domain.
-        AttributeInfo info = AttributeInfoUtil.find(&quot;dc&quot;, \
                dnsDomainAttrInfos );
-        assertEquals(AttributeInfoBuilder.build(&quot;dc&quot;, String.class, \
                EnumSet.of(Flags.REQUIRED)), info);
-        info = AttributeInfoUtil.find(&quot;telephoneNumber&quot;, \
                dnsDomainAttrInfos );
-        assertEquals(AttributeInfoBuilder.build(&quot;telephoneNumber&quot;, \
                String.class, EnumSet.of(Flags.MULTIVALUED)), info);
-        // Defined in dNSDomain.
-        info = AttributeInfoUtil.find(&quot;MXRecord&quot;, dnsDomainAttrInfos );
-        assertEquals(AttributeInfoBuilder.build(&quot;MXRecord&quot;, String.class, \
                EnumSet.of(Flags.MULTIVALUED)), info);
-    }
-
-    @Test
-    public void testAttributeTypes() {
-        LdapConfiguration config = newConfiguration(true);
-        Schema schema = newFacade(config).schema();
-        ObjectClassInfo accountInfo = \
                schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME);
-        Set&lt;AttributeInfo&gt; accountAttrInfos = accountInfo.getAttributeInfo();
-
-        assertEquals(String.class, AttributeInfoUtil.find(&quot;cn&quot;, \
                accountAttrInfos).getType());
-        assertEquals(String.class, AttributeInfoUtil.find(&quot;ou&quot;, \
                accountAttrInfos).getType());
-        assertEquals(String.class, \
                AttributeInfoUtil.find(&quot;telephoneNumber&quot;, \
                accountAttrInfos).getType());
-
-        assertEquals(byte[].class, AttributeInfoUtil.find(&quot;audio&quot;, \
                accountAttrInfos).getType());
-        assertEquals(byte[].class, AttributeInfoUtil.find(&quot;jpegPhoto&quot;, \
                accountAttrInfos).getType());
-        assertEquals(byte[].class, \
                AttributeInfoUtil.find(&quot;userCertificate&quot;, \
                accountAttrInfos).getType());
-        assertEquals(byte[].class, \
AttributeInfoUtil.find(&quot;x500UniqueIdentifier&quot;, \
                accountAttrInfos).getType());
-    }
-
-    @Test
-    public void testSyncNotSupported() {
-        LdapConfiguration config = newConfiguration();
-        LdapConnection conn = new LdapConnection(config);
-        assertEquals(ServerType.OPENDS, conn.getServerType());
-        Schema schema = newFacade(config).schema();
-        assertTrue(schema.getSupportedObjectClassesByOperation().get(SyncApiOp.class).isEmpty());
                
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapschemaLdapSc \
hemaMappingTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapschemaLdapSchemaMappingTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/schema/LdapSchemaMappingTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,175 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.schema;
+
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import java.util.EnumSet;
+import java.util.Set;
+
+import org.identityconnectors.framework.api.operations.AuthenticationApiOp;
+import org.identityconnectors.framework.api.operations.SyncApiOp;
+import org.identityconnectors.framework.common.objects.AttributeInfo;
+import org.identityconnectors.framework.common.objects.AttributeInfoBuilder;
+import org.identityconnectors.framework.common.objects.AttributeInfoUtil;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.ObjectClassInfo;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.Schema;
+import org.identityconnectors.framework.common.objects.AttributeInfo.Flags;
+import org.identityconnectors.ldap.LdapConfiguration;
+import org.identityconnectors.ldap.LdapConnection;
+import org.identityconnectors.ldap.LdapConnectorTestBase;
+import org.identityconnectors.ldap.LdapConstants;
+import org.identityconnectors.ldap.LdapConstants.ServerType;
+
+public class LdapSchemaMappingTests extends LdapConnectorTestBase {
+
+    // TODO operational attributes.
+    // TODO test for operation option infos.
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return false;
+    }
+
+    @Test
+    public void testObjectClassAttrIsReadOnly() {
+        LdapConfiguration config = newConfiguration(true);
+        Schema schema = newFacade(config).schema();
+        for (ObjectClassInfo oci : schema.getObjectClassInfo()) {
+            AttributeInfo attrInfo = AttributeInfoUtil.find(&quot;objectClass&quot;, \
oci.getAttributeInfo()); +            assertFalse(attrInfo.isRequired());
+            assertFalse(attrInfo.isCreateable());
+            assertFalse(attrInfo.isUpdateable());
+        }
+    }
+
+    @Test
+    public void testAccountSchema() {
+        LdapConfiguration config = newConfiguration(true);
+        Schema schema = newFacade(config).schema();
+
+        ObjectClassInfo oci = schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME);
+        assertFalse(oci.isContainer());
+
+        // Check some, but not all, attributes of inetOrgClass.
+        Set&lt;AttributeInfo&gt; attrInfos = oci.getAttributeInfo();
+        AttributeInfo info = AttributeInfoUtil.find(&quot;cn&quot;, attrInfos);
+        assertEquals(AttributeInfoBuilder.build(&quot;cn&quot;, String.class, \
EnumSet.of(Flags.REQUIRED, Flags.MULTIVALUED)), info); +        info = \
AttributeInfoUtil.find(&quot;uid&quot;, attrInfos); +        \
assertEquals(AttributeInfoBuilder.build(&quot;uid&quot;, String.class, \
EnumSet.of(Flags.MULTIVALUED)), info); +        info = \
AttributeInfoUtil.find(&quot;givenName&quot;, attrInfos); +        \
assertEquals(AttributeInfoBuilder.build(&quot;givenName&quot;, String.class, \
EnumSet.of(Flags.MULTIVALUED)), info); +        info = \
AttributeInfoUtil.find(&quot;sn&quot;, attrInfos); +        \
assertEquals(AttributeInfoBuilder.build(&quot;sn&quot;, String.class, \
EnumSet.of(Flags.REQUIRED, Flags.MULTIVALUED)), info); +
+        // Operational attributes.
+        info = AttributeInfoUtil.find(OperationalAttributes.PASSWORD_NAME, \
attrInfos); +        assertEquals(LdapConstants.PASSWORD, info);
+    }
+
+    @Test
+    public void testGroupSchema() {
+        LdapConfiguration config = newConfiguration(true);
+        Schema schema = newFacade(config).schema();
+
+        ObjectClassInfo oci = schema.findObjectClassInfo(ObjectClass.GROUP_NAME);
+        assertFalse(oci.isContainer());
+
+        Set&lt;AttributeInfo&gt; attrInfos = oci.getAttributeInfo();
+
+        AttributeInfo info = AttributeInfoUtil.find(&quot;cn&quot;, attrInfos);
+        assertEquals(AttributeInfoBuilder.build(&quot;cn&quot;, String.class, \
EnumSet.of(Flags.REQUIRED, Flags.MULTIVALUED)), info); +    }
+
+    @Test
+    public void testAuthenticationOnlyForAccounts() {
+        LdapConfiguration config = newConfiguration(true);
+        Schema schema = newFacade(config).schema();
+        Set&lt;ObjectClassInfo&gt; ocis = \
schema.getSupportedObjectClassesByOperation().get(AuthenticationApiOp.class); +       \
assertEquals(1, ocis.size()); +        \
assertTrue(ocis.iterator().next().is(ObjectClass.ACCOUNT_NAME)); +    }
+
+    @Test
+    public void testAllObjectClassesInSchema() {
+        Schema schema = newFacade(newConfiguration(true)).schema();
+        // Well, at least some of the most well-known.
+        assertNotNull(schema.findObjectClassInfo(&quot;organization&quot;));
+        assertNotNull(schema.findObjectClassInfo(&quot;groupOfNames&quot;));
+        assertNotNull(schema.findObjectClassInfo(&quot;dNSDomain&quot;));
+        // top is abstract, so it shouldn't be in the schema.
+        assertNull(schema.findObjectClassInfo(&quot;top&quot;));
+        // extensibleObject is auxiliary, so it shouldn't be in the schema.
+        assertNull(schema.findObjectClassInfo(&quot;extensibleObject&quot;));
+    }
+
+    @Test
+    public void testArbitraryObjectClass() {
+        Schema schema = newFacade(newConfiguration(true)).schema();
+
+        ObjectClassInfo dnsDomainInfo = \
schema.findObjectClassInfo(&quot;dNSDomain&quot;); +        \
assertTrue(dnsDomainInfo.isContainer()); +
+        Set&lt;AttributeInfo&gt; dnsDomainAttrInfos = dnsDomainInfo \
.getAttributeInfo(); +        // Inherited from domain.
+        AttributeInfo info = AttributeInfoUtil.find(&quot;dc&quot;, \
dnsDomainAttrInfos ); +        \
assertEquals(AttributeInfoBuilder.build(&quot;dc&quot;, String.class, \
EnumSet.of(Flags.REQUIRED)), info); +        info = \
AttributeInfoUtil.find(&quot;telephoneNumber&quot;, dnsDomainAttrInfos ); +        \
assertEquals(AttributeInfoBuilder.build(&quot;telephoneNumber&quot;, String.class, \
EnumSet.of(Flags.MULTIVALUED)), info); +        // Defined in dNSDomain.
+        info = AttributeInfoUtil.find(&quot;MXRecord&quot;, dnsDomainAttrInfos );
+        assertEquals(AttributeInfoBuilder.build(&quot;MXRecord&quot;, String.class, \
EnumSet.of(Flags.MULTIVALUED)), info); +    }
+
+    @Test
+    public void testAttributeTypes() {
+        LdapConfiguration config = newConfiguration(true);
+        Schema schema = newFacade(config).schema();
+        ObjectClassInfo accountInfo = \
schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME); +        \
Set&lt;AttributeInfo&gt; accountAttrInfos = accountInfo.getAttributeInfo(); +
+        assertEquals(String.class, AttributeInfoUtil.find(&quot;cn&quot;, \
accountAttrInfos).getType()); +        assertEquals(String.class, \
AttributeInfoUtil.find(&quot;ou&quot;, accountAttrInfos).getType()); +        \
assertEquals(String.class, AttributeInfoUtil.find(&quot;telephoneNumber&quot;, \
accountAttrInfos).getType()); +
+        assertEquals(byte[].class, AttributeInfoUtil.find(&quot;audio&quot;, \
accountAttrInfos).getType()); +        assertEquals(byte[].class, \
AttributeInfoUtil.find(&quot;jpegPhoto&quot;, accountAttrInfos).getType()); +        \
assertEquals(byte[].class, AttributeInfoUtil.find(&quot;userCertificate&quot;, \
accountAttrInfos).getType()); +        assertEquals(byte[].class, \
AttributeInfoUtil.find(&quot;x500UniqueIdentifier&quot;, \
accountAttrInfos).getType()); +    }
+
+    @Test
+    public void testSyncNotSupported() {
+        LdapConfiguration config = newConfiguration();
+        LdapConnection conn = new LdapConnection(config);
+        assertEquals(ServerType.OPENDS, conn.getServerType());
+        Schema schema = newFacade(config).schema();
+        assertTrue(schema.getSupportedObjectClassesByOperation().get(SyncApiOp.class).isEmpty());
 +    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsearchLdapFilterTranslatorTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,174 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.search;
-
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertEquals;
-import org.testng.annotations.Test;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.filter.ContainsAllValuesFilter;
                
-import org.identityconnectors.framework.common.objects.filter.ContainsFilter;
-import org.identityconnectors.framework.common.objects.filter.EndsWithFilter;
-import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
-import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
-import org.identityconnectors.framework.common.objects.filter.GreaterThanFilter;
-import org.identityconnectors.framework.common.objects.filter.GreaterThanOrEqualFilter;
                
-import org.identityconnectors.framework.common.objects.filter.LessThanFilter;
-import org.identityconnectors.framework.common.objects.filter.LessThanOrEqualFilter;
-import org.identityconnectors.framework.common.objects.filter.StartsWithFilter;
-import org.identityconnectors.ldap.LdapConfiguration;
-import org.identityconnectors.ldap.LdapConnection;
-import org.identityconnectors.ldap.LdapConnectorTestBase;
-import org.identityconnectors.ldap.schema.LdapSchemaMapping;
-
-public class LdapFilterTranslatorTests {
-
-    @Test
-    public void testAnd() {
-        assertEquals(LdapFilter.forNativeFilter(&quot;(&amp;(foo=1)(bar=2))&quot;), \
                newTranslator().createAndExpression(
-                LdapFilter.forNativeFilter(&quot;(foo=1)&quot;),
-                LdapFilter.forNativeFilter(&quot;(bar=2)&quot;)));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(foo=1)&quot;), \
                newTranslator().createAndExpression(
-                LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;),
-                LdapFilter.forNativeFilter(&quot;(foo=1)&quot;)));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(&amp;(foo=1)(bar=2))&quot;), \
                newTranslator().createAndExpression(
-                LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(foo=1)&quot;),
                
-                LdapFilter.forNativeFilter(&quot;(bar=2)&quot;)));
-        assertNull(newTranslator().createAndExpression(
-                LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(foo=1)&quot;),
                
-                LdapFilter.forEntryDN(&quot;dc=example,dc=org&quot;).withNativeFilter(&quot;(bar=2)&quot;)));
                
-    }
-
-    @Test
-    public void testOr() {
-        assertEquals(LdapFilter.forNativeFilter(&quot;(|(foo=1)(bar=2))&quot;),
-                newTranslator().createOrExpression(LdapFilter.forNativeFilter(&quot;(foo=1)&quot;), \
                LdapFilter.forNativeFilter(&quot;(bar=2)&quot;)));
-        assertNull(newTranslator().createOrExpression(
-                LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
                LdapFilter.forNativeFilter(&quot;(foo=1)&quot;)));
-    }
-
-    @Test
-    public void testContains() {
-        ContainsFilter filter = (ContainsFilter) \
                FilterBuilder.contains(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
                newTranslator().createContainsExpression(filter, false));
-
-        filter = (ContainsFilter) \
                FilterBuilder.contains(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;bar&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*bar*)&quot;), \
                newTranslator().createContainsExpression(filter, false));
-    }
-
-    @Test
-    public void testStartsWith() {
-        StartsWithFilter filter = (StartsWithFilter) \
                FilterBuilder.startsWith(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
                newTranslator().createStartsWithExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*))&quot;), \
                newTranslator().createStartsWithExpression(filter, true));
-
-        filter = (StartsWithFilter) \
                FilterBuilder.startsWith(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;bar&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=bar*)&quot;), \
                newTranslator().createStartsWithExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=bar*))&quot;), \
                newTranslator().createStartsWithExpression(filter, true));
-    }
-
-    @Test
-    public void testEndsWith() {
-        EndsWithFilter filter = (EndsWithFilter) \
                FilterBuilder.endsWith(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
                newTranslator().createEndsWithExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*))&quot;), \
                newTranslator().createEndsWithExpression(filter, true));
-
-        filter = (EndsWithFilter) \
                FilterBuilder.endsWith(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;bar&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*bar)&quot;), \
                newTranslator().createEndsWithExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*bar))&quot;), \
                newTranslator().createEndsWithExpression(filter, true));
-    }
-
-    @Test
-    public void testEquals() {
-        EqualsFilter filter = (EqualsFilter) \
                FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;));
-        assertNull(newTranslator().createEqualsExpression(filter, false));
-
-        filter = (EqualsFilter) \
                FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
                newTranslator().createEqualsExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*))&quot;), \
                newTranslator().createEqualsExpression(filter, true));
-
-        filter = (EqualsFilter) \
                FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;, \
                &quot;bar&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo=bar)&quot;), \
                newTranslator().createEqualsExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=bar))&quot;), \
                newTranslator().createEqualsExpression(filter, true));
-
-        filter = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;, &quot;bar&quot;, \
                &quot;baz&quot;));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(&amp;(foo=bar)(foo=baz))&quot;), \
                newTranslator().createEqualsExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(&amp;(foo=bar)(foo=baz)))&quot;), \
                newTranslator().createEqualsExpression(filter, true));
-    }
-
-    @Test
-    public void testGreaterThan() {
-        GreaterThanFilter filter = (GreaterThanFilter) \
                FilterBuilder.greaterThan(AttributeBuilder.build(&quot;foo&quot;, \
                42));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&lt;=42))&quot;), \
                newTranslator().createGreaterThanExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo&lt;=42)&quot;), \
                newTranslator().createGreaterThanExpression(filter, true));
-    }
-
-    @Test
-    public void testGreaterThanOrEqual() {
-        GreaterThanOrEqualFilter filter = (GreaterThanOrEqualFilter) \
                FilterBuilder.greaterThanOrEqualTo(AttributeBuilder.build(&quot;foo&quot;, \
                42));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo&gt;=42)&quot;), \
                newTranslator().createGreaterThanOrEqualExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&gt;=42))&quot;), \
                newTranslator().createGreaterThanOrEqualExpression(filter, true));
-    }
-
-    @Test
-    public void testLessThan() {
-        LessThanFilter filter = (LessThanFilter) \
                FilterBuilder.lessThan(AttributeBuilder.build(&quot;foo&quot;, 42));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&gt;=42))&quot;), \
                newTranslator().createLessThanExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo&gt;=42)&quot;), \
                newTranslator().createLessThanExpression(filter, true));
-    }
-
-    @Test
-    public void testLessThanOrEqual() {
-        LessThanOrEqualFilter filter = (LessThanOrEqualFilter) \
                FilterBuilder.lessThanOrEqualTo(AttributeBuilder.build(&quot;foo&quot;, \
                42));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(foo&lt;=42)&quot;), \
                newTranslator().createLessThanOrEqualExpression(filter, false));
-        assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&lt;=42))&quot;), \
                newTranslator().createLessThanOrEqualExpression(filter, true));
-    }
-
-    @Test
-    public void testEntryDN() {
-        ContainsFilter contains = (ContainsFilter) \
FilterBuilder.contains(AttributeBuilder.build(&quot;entryDN&quot;, \
                &quot;dc=example,dc=com&quot;));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
                newTranslator().createContainsExpression(contains, false));
-
-        StartsWithFilter startsWith = (StartsWithFilter) \
FilterBuilder.startsWith(AttributeBuilder.build(&quot;entryDN&quot;, \
                &quot;dc=example,dc=com&quot;));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
                newTranslator().createStartsWithExpression(startsWith, false));
-
-        EndsWithFilter endsWith = (EndsWithFilter) \
FilterBuilder.endsWith(AttributeBuilder.build(&quot;entryDN&quot;, \
                &quot;dc=example,dc=com&quot;));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
                newTranslator().createEndsWithExpression(endsWith, false));
-
-        EqualsFilter equals = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;entryDN&quot;, \
                &quot;dc=example,dc=com&quot;));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
                newTranslator().createEqualsExpression(equals, false));
-
-        ContainsAllValuesFilter containsAllValues = (ContainsAllValuesFilter) \
FilterBuilder.containsAllValues(AttributeBuilder.build(&quot;entryDN&quot;, \
                &quot;dc=example,dc=com&quot;));
-        assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
                newTranslator().createContainsAllValuesExpression(containsAllValues, \
                false));
-
-        containsAllValues = (ContainsAllValuesFilter) \
FilterBuilder.containsAllValues(AttributeBuilder.build(&quot;entryDN&quot;, \
                &quot;dc=example,dc=com&quot;, \
                &quot;o=Acme,dc=example,dc=com&quot;));
-        assertNull(newTranslator().createContainsAllValuesExpression(containsAllValues, \
                false));
-    }
-
-    private static LdapFilterTranslator newTranslator() {
-        LdapConfiguration config = LdapConnectorTestBase.newConfiguration();
-        LdapConnection conn = new LdapConnection(config);
-        return new LdapFilterTranslator(new LdapSchemaMapping(conn), \
                ObjectClass.ACCOUNT);
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsearchLdapFi \
lterTranslatorTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapsearchLdapFilterTranslatorTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapFilterTranslatorTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.search;
+
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.Test;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.filter.ContainsAllValuesFilter;
 +import org.identityconnectors.framework.common.objects.filter.ContainsFilter;
+import org.identityconnectors.framework.common.objects.filter.EndsWithFilter;
+import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
+import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
+import org.identityconnectors.framework.common.objects.filter.GreaterThanFilter;
+import org.identityconnectors.framework.common.objects.filter.GreaterThanOrEqualFilter;
 +import org.identityconnectors.framework.common.objects.filter.LessThanFilter;
+import org.identityconnectors.framework.common.objects.filter.LessThanOrEqualFilter;
+import org.identityconnectors.framework.common.objects.filter.StartsWithFilter;
+import org.identityconnectors.ldap.LdapConfiguration;
+import org.identityconnectors.ldap.LdapConnection;
+import org.identityconnectors.ldap.LdapConnectorTestBase;
+import org.identityconnectors.ldap.schema.LdapSchemaMapping;
+
+public class LdapFilterTranslatorTests {
+
+    @Test
+    public void testAnd() {
+        assertEquals(LdapFilter.forNativeFilter(&quot;(&amp;(foo=1)(bar=2))&quot;), \
newTranslator().createAndExpression( +                \
LdapFilter.forNativeFilter(&quot;(foo=1)&quot;), +                \
LdapFilter.forNativeFilter(&quot;(bar=2)&quot;))); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(foo=1)&quot;), \
newTranslator().createAndExpression( +                \
LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), +                \
LdapFilter.forNativeFilter(&quot;(foo=1)&quot;))); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(&amp;(foo=1)(bar=2))&quot;), \
newTranslator().createAndExpression( +                \
LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(foo=1)&quot;),
 +                LdapFilter.forNativeFilter(&quot;(bar=2)&quot;)));
+        assertNull(newTranslator().createAndExpression(
+                LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;).withNativeFilter(&quot;(foo=1)&quot;),
 +                LdapFilter.forEntryDN(&quot;dc=example,dc=org&quot;).withNativeFilter(&quot;(bar=2)&quot;)));
 +    }
+
+    @Test
+    public void testOr() {
+        assertEquals(LdapFilter.forNativeFilter(&quot;(|(foo=1)(bar=2))&quot;),
+                newTranslator().createOrExpression(LdapFilter.forNativeFilter(&quot;(foo=1)&quot;), \
LdapFilter.forNativeFilter(&quot;(bar=2)&quot;))); +        \
assertNull(newTranslator().createOrExpression( +                \
LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
LdapFilter.forNativeFilter(&quot;(foo=1)&quot;))); +    }
+
+    @Test
+    public void testContains() {
+        ContainsFilter filter = (ContainsFilter) \
FilterBuilder.contains(AttributeBuilder.build(&quot;foo&quot;, &quot;&quot;)); +      \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
newTranslator().createContainsExpression(filter, false)); +
+        filter = (ContainsFilter) \
FilterBuilder.contains(AttributeBuilder.build(&quot;foo&quot;, &quot;bar&quot;)); +   \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*bar*)&quot;), \
newTranslator().createContainsExpression(filter, false)); +    }
+
+    @Test
+    public void testStartsWith() {
+        StartsWithFilter filter = (StartsWithFilter) \
FilterBuilder.startsWith(AttributeBuilder.build(&quot;foo&quot;, &quot;&quot;)); +    \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
newTranslator().createStartsWithExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*))&quot;), \
newTranslator().createStartsWithExpression(filter, true)); +
+        filter = (StartsWithFilter) \
FilterBuilder.startsWith(AttributeBuilder.build(&quot;foo&quot;, &quot;bar&quot;)); + \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=bar*)&quot;), \
newTranslator().createStartsWithExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=bar*))&quot;), \
newTranslator().createStartsWithExpression(filter, true)); +    }
+
+    @Test
+    public void testEndsWith() {
+        EndsWithFilter filter = (EndsWithFilter) \
FilterBuilder.endsWith(AttributeBuilder.build(&quot;foo&quot;, &quot;&quot;)); +      \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
newTranslator().createEndsWithExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*))&quot;), \
newTranslator().createEndsWithExpression(filter, true)); +
+        filter = (EndsWithFilter) \
FilterBuilder.endsWith(AttributeBuilder.build(&quot;foo&quot;, &quot;bar&quot;)); +   \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*bar)&quot;), \
newTranslator().createEndsWithExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*bar))&quot;), \
newTranslator().createEndsWithExpression(filter, true)); +    }
+
+    @Test
+    public void testEquals() {
+        EqualsFilter filter = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;)); +        \
assertNull(newTranslator().createEqualsExpression(filter, false)); +
+        filter = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;, &quot;&quot;)); +       \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=*)&quot;), \
newTranslator().createEqualsExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=*))&quot;), \
newTranslator().createEqualsExpression(filter, true)); +
+        filter = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;, &quot;bar&quot;)); +    \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo=bar)&quot;), \
newTranslator().createEqualsExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo=bar))&quot;), \
newTranslator().createEqualsExpression(filter, true)); +
+        filter = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;foo&quot;, &quot;bar&quot;, \
&quot;baz&quot;)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(&amp;(foo=bar)(foo=baz))&quot;), \
newTranslator().createEqualsExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(&amp;(foo=bar)(foo=baz)))&quot;), \
newTranslator().createEqualsExpression(filter, true)); +    }
+
+    @Test
+    public void testGreaterThan() {
+        GreaterThanFilter filter = (GreaterThanFilter) \
FilterBuilder.greaterThan(AttributeBuilder.build(&quot;foo&quot;, 42)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&lt;=42))&quot;), \
newTranslator().createGreaterThanExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo&lt;=42)&quot;), \
newTranslator().createGreaterThanExpression(filter, true)); +    }
+
+    @Test
+    public void testGreaterThanOrEqual() {
+        GreaterThanOrEqualFilter filter = (GreaterThanOrEqualFilter) \
FilterBuilder.greaterThanOrEqualTo(AttributeBuilder.build(&quot;foo&quot;, 42)); +    \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo&gt;=42)&quot;), \
newTranslator().createGreaterThanOrEqualExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&gt;=42))&quot;), \
newTranslator().createGreaterThanOrEqualExpression(filter, true)); +    }
+
+    @Test
+    public void testLessThan() {
+        LessThanFilter filter = (LessThanFilter) \
FilterBuilder.lessThan(AttributeBuilder.build(&quot;foo&quot;, 42)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&gt;=42))&quot;), \
newTranslator().createLessThanExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo&gt;=42)&quot;), \
newTranslator().createLessThanExpression(filter, true)); +    }
+
+    @Test
+    public void testLessThanOrEqual() {
+        LessThanOrEqualFilter filter = (LessThanOrEqualFilter) \
FilterBuilder.lessThanOrEqualTo(AttributeBuilder.build(&quot;foo&quot;, 42)); +       \
assertEquals(LdapFilter.forNativeFilter(&quot;(foo&lt;=42)&quot;), \
newTranslator().createLessThanOrEqualExpression(filter, false)); +        \
assertEquals(LdapFilter.forNativeFilter(&quot;(!(foo&lt;=42))&quot;), \
newTranslator().createLessThanOrEqualExpression(filter, true)); +    }
+
+    @Test
+    public void testEntryDN() {
+        ContainsFilter contains = (ContainsFilter) \
FilterBuilder.contains(AttributeBuilder.build(&quot;entryDN&quot;, \
&quot;dc=example,dc=com&quot;)); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
newTranslator().createContainsExpression(contains, false)); +
+        StartsWithFilter startsWith = (StartsWithFilter) \
FilterBuilder.startsWith(AttributeBuilder.build(&quot;entryDN&quot;, \
&quot;dc=example,dc=com&quot;)); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
newTranslator().createStartsWithExpression(startsWith, false)); +
+        EndsWithFilter endsWith = (EndsWithFilter) \
FilterBuilder.endsWith(AttributeBuilder.build(&quot;entryDN&quot;, \
&quot;dc=example,dc=com&quot;)); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
newTranslator().createEndsWithExpression(endsWith, false)); +
+        EqualsFilter equals = (EqualsFilter) \
FilterBuilder.equalTo(AttributeBuilder.build(&quot;entryDN&quot;, \
&quot;dc=example,dc=com&quot;)); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
newTranslator().createEqualsExpression(equals, false)); +
+        ContainsAllValuesFilter containsAllValues = (ContainsAllValuesFilter) \
FilterBuilder.containsAllValues(AttributeBuilder.build(&quot;entryDN&quot;, \
&quot;dc=example,dc=com&quot;)); +        \
assertEquals(LdapFilter.forEntryDN(&quot;dc=example,dc=com&quot;), \
newTranslator().createContainsAllValuesExpression(containsAllValues, false)); +
+        containsAllValues = (ContainsAllValuesFilter) \
FilterBuilder.containsAllValues(AttributeBuilder.build(&quot;entryDN&quot;, \
&quot;dc=example,dc=com&quot;, &quot;o=Acme,dc=example,dc=com&quot;)); +        \
assertNull(newTranslator().createContainsAllValuesExpression(containsAllValues, \
false)); +    }
+
+    private static LdapFilterTranslator newTranslator() {
+        LdapConfiguration config = LdapConnectorTestBase.newConfiguration();
+        LdapConnection conn = new LdapConnection(config);
+        return new LdapFilterTranslator(new LdapSchemaMapping(conn), \
ObjectClass.ACCOUNT); +    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsearchLdapSearchTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,422 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- * &quot;Portions Copyrighted 2014 ForgeRock AS&quot;
- */
-package org.identityconnectors.ldap.search;
-
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import static java.util.Collections.singleton;
-import static org.identityconnectors.common.CollectionUtil.newSet;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.common.security.GuardedString.Accessor;
-import org.identityconnectors.framework.api.ConnectorFacade;
-import org.identityconnectors.framework.common.exceptions.ConnectorException;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.AttributeInfo;
-import org.identityconnectors.framework.common.objects.AttributeInfoUtil;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.identityconnectors.framework.common.objects.QualifiedUid;
-import org.identityconnectors.framework.common.objects.ResultsHandler;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.identityconnectors.framework.common.objects.filter.Filter;
-import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
-import org.identityconnectors.ldap.LdapConfiguration;
-import org.identityconnectors.ldap.LdapConnection;
-import org.identityconnectors.ldap.LdapConnectorTestBase;
-import org.identityconnectors.test.common.TestHelpers;
-import org.identityconnectors.test.common.ToListResultsHandler;
-
-public class LdapSearchTests extends LdapConnectorTestBase {
-
-    // TODO operational attributes.
-    // TODO LDAP directory attributes (entryDN, etc.).
-
-    @Override
-    protected boolean restartServerAfterEachTest() {
-        return false;
-    }
-
-    @Test
-    public void testLdapFilter() {
-        LdapConnection conn = new LdapConnection(newConfiguration());
-
-        LdapFilter filter = LdapFilter.forEntryDN(BUGS_BUNNY_DN);
-        ToListResultsHandler handler = new ToListResultsHandler();
-        new LdapSearch(conn, ObjectClass.ACCOUNT, filter, handler, new \
                OperationOptionsBuilder().build()).execute();
-        assertEquals(1, handler.getObjects().size());
-
-        filter = filter.withNativeFilter(&quot;(foo=bar)&quot;);
-        handler = new ToListResultsHandler();
-        new LdapSearch(conn, ObjectClass.ACCOUNT, filter, handler, new \
                OperationOptionsBuilder().build()).execute();
-        assertTrue(handler.getObjects().isEmpty());
-    }
-
-    @Test
-    public void testLdapFilterWithNonExistingEntryDN() {
-        LdapFilter filter = LdapFilter.forEntryDN(&quot;dc=foo,dc=bar&quot;);
-
-        // VLV index.
-        LdapConfiguration config = newConfiguration();
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(false);
-        searchExpectingNoResult(config, filter);
-
-        // Simple paged results.
-        config = newConfiguration();
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(true);
-        searchExpectingNoResult(config, filter);
-
-        // No paging.
-        config = newConfiguration();
-        config.setUseBlocks(false);
-        searchExpectingNoResult(config, filter);
-    }
-
-
-    @Test
-    public void testLdapFilterWithInvalidEntryDN() {
-        LdapFilter filter = LdapFilter.forEntryDN(&quot;dc=foo,,&quot;);
-
-        // VLV index.
-        LdapConfiguration config = newConfiguration();
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(false);
-        searchExpectingNoResult(config, filter);
-
-        // Simple paged results.
-        config = newConfiguration();
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(true);
-        searchExpectingNoResult(config, filter);
-
-        // No paging.
-        config = newConfiguration();
-        config.setUseBlocks(false);
-        searchExpectingNoResult(config, filter);
-    }
-
-    private void searchExpectingNoResult(LdapConfiguration config, LdapFilter \
                filter) {
-        LdapConnection conn = new LdapConnection(config);
-        ToListResultsHandler handler = new ToListResultsHandler();
-        // Should not fail with NameNotFoundException or InvalidNameException.
-        new LdapSearch(conn, ObjectClass.ACCOUNT, filter, handler, new \
                OperationOptionsBuilder().build()).execute();
-        assertTrue(handler.getObjects().isEmpty());
-    }
-
-    @Test
-    public void testCanCancelSearch() {
-        // VLV Index.
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(false);
-        searchExpectingSingleResult(config);
-
-        // Simple paged results.
-        config = newConfiguration();
-        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(true);
-        searchExpectingSingleResult(config);
-
-        // No paging.
-        config = newConfiguration();
-        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
-        config.setUseBlocks(false);
-        searchExpectingSingleResult(config);
-    }
-
-    private void searchExpectingSingleResult(LdapConfiguration config) {
-        LdapConnection conn = new LdapConnection(config);
-        FirstOnlyResultsHandler handler = new FirstOnlyResultsHandler();
-        new LdapSearch(conn, ObjectClass.ACCOUNT, null, handler, new \
                OperationOptionsBuilder().build()).execute();
-        handler.assertSingleResult();
-    }
-
-    @Test
-    public void testSimplePagedSearch() {
-        LdapConfiguration config = newConfiguration();
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(true);
-        ConnectorFacade facade = newFacade(config);
-
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                ObjectClass.ACCOUNT, null);
-        assertNotNull(getObjectByName(objects, BUGS_BUNNY_DN));
-        assertNotNull(getObjectByName(objects, USER_0_DN));
-        // 1000 is the default search size limit for OpenDS.
-        assertTrue(objects.size() &gt; 1000);
-    }
-
-    @Test
-    public void testVlvIndexSearch() {
-        LdapConfiguration config = newConfiguration();
-        config.setBaseContexts(EXAMPLE_COM_DN);
-        config.setUseBlocks(true);
-        config.setUsePagedResultControl(false);
-        config.setUidAttribute(&quot;entryDN&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                ObjectClass.ACCOUNT, null);
-        assertNotNull(getObjectByName(objects, USER_0_DN));
-        // 1000 is the default search size limit for OpenDS.
-        assertTrue(objects.size() &gt; 1000);
-
-        // OpenDS-specific.
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;debugsearchindex&quot;);
-        FirstOnlyResultsHandler handler = new FirstOnlyResultsHandler();
-        facade.search(ObjectClass.ACCOUNT, null, handler, builder.build());
-        String debugsearch = \
handler.getSingleResult().getAttributeByName(&quot;debugsearchindex&quot;).getValue().get(0).toString();
                
-        assertTrue(debugsearch.contains(&quot;vlv&quot;));
-    }
-
-    @Test(expectedExceptions = ConnectorException.class)
-    public void testNoUseBlocks() {
-        LdapConfiguration config = newConfiguration();
-        config.setUseBlocks(false);
-        ConnectorFacade facade = newFacade(config);
-        // This should fail, since the search will exceed the maximum number of
-        // entries to return.
-        TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null);
-    }
-
-    @Test
-    public void testWithFilter() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
-    }
-
-    @Test
-    public void testWithFilterByBinaryAttribute() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-
-        byte[] photo = { -4, -3, -2, -1, 0, 1, 2, 3, 63, 127 };
-        Attribute photoAttr = AttributeBuilder.build(&quot;jpegPhoto&quot;, photo);
-        Uid newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, bunny.getUid(), \
                singleton(photoAttr), null);
-
-        ConnectorObject bunnyWithPhoto = searchByAttribute(facade, \
                ObjectClass.ACCOUNT, photoAttr, &quot;jpegPhoto&quot;);
-        assertEquals(newUid, bunnyWithPhoto.getUid());
-    }
-
-    @Test
-    public void testAttributesToGet() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(USER_0_DN), &quot;employeeNumber&quot;, \
                &quot;telephoneNumber&quot;);
-
-        Set&lt;Attribute&gt; attrs = newSet(object.getAttributes());
-        assertTrue(attrs.remove(AttributeUtil.find(Uid.NAME, attrs)));
-        assertTrue(attrs.remove(AttributeUtil.find(Name.NAME, attrs)));
-        assertTrue(attrs.remove(AttributeUtil.find(&quot;employeeNumber&quot;, \
                attrs)));
-        assertTrue(attrs.remove(AttributeUtil.find(&quot;telephoneNumber&quot;, \
                attrs)));
-
-        assertTrue(attrs.isEmpty());
-    }
-
-    @Test
-    public void testAttributesReturnedByDefaultWithNoValueAreNotReturned() {
-        LdapConfiguration config = newConfiguration(true);
-        ConnectorFacade facade = newFacade(config);
-        AttributeInfo attr = AttributeInfoUtil.find(&quot;givenName&quot;, \
                facade.schema().findObjectClassInfo(ObjectClass.ACCOUNT_NAME).getAttributeInfo());
                
-        assertTrue(attr.isReturnedByDefault());
-
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN));
-        assertNull(object.getAttributeByName(&quot;givenName&quot;));
-    }
-
-    @Test
-    public void testAttributesToGetNotPresentInEntryAreEmpty() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN), &quot;employeeNumber&quot;);
-
-        assertTrue(object.getAttributeByName(&quot;employeeNumber&quot;).getValue().isEmpty());
                
-    }
-
-    @Test
-    public void testScope() {
-        ConnectorFacade facade = newFacade();
-        // Find an organization to pass in OP_CONTAINER.
-        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
-        ConnectorObject organization = searchByAttribute(facade, oclass, new \
                Name(BIG_COMPANY_DN));
-
-        // There are no accounts directly under the organization...
-        OperationOptionsBuilder optionsBuilder = new OperationOptionsBuilder();
-        optionsBuilder.setScope(OperationOptions.SCOPE_ONE_LEVEL);
-        optionsBuilder.setContainer(new QualifiedUid(oclass, \
                organization.getUid()));
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                ObjectClass.ACCOUNT, null, optionsBuilder.build());
-        assertTrue(objects.isEmpty());
-
-        // ... but there are some in the organization subtree.
-        optionsBuilder.setScope(OperationOptions.SCOPE_SUBTREE);
-        objects = TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, \
                optionsBuilder.build());
-        assertFalse(objects.isEmpty());
-    }
-
-    @Test
-    public void testAccountSearchFilter() {
-        ConnectorFacade facade = newFacade();
-        // Find an organization to pass in OP_CONTAINER.
-        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
-        ConnectorObject organization = searchByAttribute(facade, oclass, new \
                Name(ACME_DN));
-
-        // First just check that there really are some users.
-        OperationOptionsBuilder optionsBuilder = new OperationOptionsBuilder();
-        optionsBuilder.setScope(OperationOptions.SCOPE_SUBTREE);
-        optionsBuilder.setContainer(new QualifiedUid(oclass, \
                organization.getUid()));
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                ObjectClass.ACCOUNT, null, optionsBuilder.build());
-        assertNotNull(getObjectByName(objects, BUGS_BUNNY_DN));
-        assertNotNull(getObjectByName(objects, ELMER_FUDD_DN));
-
-        LdapConfiguration config = newConfiguration();
-        config.setAccountSearchFilter(&quot;(uid=&quot; + BUGS_BUNNY_UID + \
                &quot;)&quot;);
-        facade = newFacade(config);
-        objects = TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, \
                optionsBuilder.build());
-        assertEquals(1, objects.size());
-        assertNotNull(getObjectByName(objects, BUGS_BUNNY_DN));
-    }
-
-    @Test
-    public void testAccountSearchFilterOnlyAppliesToAccounts() {
-        LdapConfiguration config = newConfiguration();
-        config.setAccountSearchFilter(&quot;(cn=foobarbaz)&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        // If the (cn=foobarbaz) filter above applied, the search would return \
                nothing.
-        assertNotNull(searchByAttribute(facade, new \
                ObjectClass(&quot;organization&quot;), new Name(ACME_DN)));
-    }
-
-    @Test
-    public void testMissingParenthesesAddedToAccountSearchFilter() {
-        LdapConfiguration config = newConfiguration();
-        config.setAccountSearchFilter(&quot;uid=&quot; + BUGS_BUNNY_UID); // No \
                parentheses enclosing the filter.
-        ConnectorFacade facade = newFacade(config);
-
-        // If parentheses were not added, the search would fail.
-        assertNotNull(searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN)));
-    }
-
-    @Test
-    public void testMultipleBaseDNs() {
-        ConnectorFacade facade = newFacade();
-
-        // This should find accounts from both base DNs.
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
                ObjectClass.ACCOUNT, null);
-        assertNotNull(getObjectByName(objects, BUGS_BUNNY_DN));
-        assertNotNull(getObjectByName(objects, USER_0_DN));
-    }
-
-    @Test
-    public void testUidAttributeCn() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;cn&quot;));
-        config.setUidAttribute(&quot;cn&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Uid(BUGS_BUNNY_CN));
-        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
-    }
-
-    @Test
-    public void testUidAttributeEntryDN() {
-        LdapConfiguration config = newConfiguration();
-        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
-        config.setUidAttribute(&quot;entryDN&quot;);
-        ConnectorFacade facade = newFacade(config);
-
-        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Uid(BUGS_BUNNY_DN));
-        assertEquals(BUGS_BUNNY_DN, bunny.getName().getNameValue());
-    }
-
-    @Test
-    public void testSearchArbitraryObjectClass() {
-        ConnectorFacade facade = newFacade();
-
-        // Simplest: try w/o filter.
-        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, new \
                ObjectClass(&quot;country&quot;), null, null);
-        ConnectorObject czechRep = getObjectByName(objects, CZECH_REPUBLIC_DN);
-
-        // Try with a name filter and options.
-        Filter filter = FilterBuilder.equalTo(AttributeBuilder.build(Name.NAME, \
                CZECH_REPUBLIC_DN));
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;c&quot;);
-        objects = TestHelpers.searchToList(facade, new \
                ObjectClass(&quot;country&quot;), filter, builder.build());
-        czechRep = getObjectByName(objects, CZECH_REPUBLIC_DN);
-        assertEquals(CZECH_REPUBLIC_C, \
                AttributeUtil.getAsStringValue(czechRep.getAttributeByName(&quot;c&quot;)));
                
-    }
-
-    @Test
-    public void testCannotReturnPasswordFromSearch() {
-        ConnectorFacade facade = newFacade();
-        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
                Name(BUGS_BUNNY_DN), OperationalAttributes.PASSWORD_NAME);
-        GuardedString password = (GuardedString) \
                bunny.getAttributeByName(OperationalAttributes.PASSWORD_NAME).getValue().get(0);
                
-        password.access(new Accessor() {
-            public void access(char[] clearChars) {
-                assertEquals(0, clearChars.length);
-            }
-        });
-    }
-
-    private static ConnectorObject getObjectByName(List&lt;ConnectorObject&gt; \
                objects, String name) {
-        for (ConnectorObject object : objects) {
-            if (name.equals(object.getName().getNameValue())) {
-                return object;
-            }
-        }
-        return null;
-    }
-
-    private static final class FirstOnlyResultsHandler implements ResultsHandler {
-
-        private final List&lt;ConnectorObject&gt; objects = new \
                ArrayList&lt;ConnectorObject&gt;();
-
-        public boolean handle(ConnectorObject obj) {
-            objects.add(obj);
-            return false; // We only want the first one.
-        }
-
-        public void assertSingleResult() {
-            assertEquals(1, objects.size());
-        }
-
-        public ConnectorObject getSingleResult() {
-            return objects.get(0);
-        }
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsearchLdapSe \
archTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapsearchLdapSearchTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/search/LdapSearchTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,422 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ * &quot;Portions Copyrighted 2014 ForgeRock AS&quot;
+ */
+package org.identityconnectors.ldap.search;
+
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import static java.util.Collections.singleton;
+import static org.identityconnectors.common.CollectionUtil.newSet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.common.security.GuardedString.Accessor;
+import org.identityconnectors.framework.api.ConnectorFacade;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.AttributeInfo;
+import org.identityconnectors.framework.common.objects.AttributeInfoUtil;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.QualifiedUid;
+import org.identityconnectors.framework.common.objects.ResultsHandler;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.identityconnectors.framework.common.objects.filter.Filter;
+import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
+import org.identityconnectors.ldap.LdapConfiguration;
+import org.identityconnectors.ldap.LdapConnection;
+import org.identityconnectors.ldap.LdapConnectorTestBase;
+import org.identityconnectors.test.common.TestHelpers;
+import org.identityconnectors.test.common.ToListResultsHandler;
+
+public class LdapSearchTests extends LdapConnectorTestBase {
+
+    // TODO operational attributes.
+    // TODO LDAP directory attributes (entryDN, etc.).
+
+    @Override
+    protected boolean restartServerAfterEachTest() {
+        return false;
+    }
+
+    @Test
+    public void testLdapFilter() {
+        LdapConnection conn = new LdapConnection(newConfiguration());
+
+        LdapFilter filter = LdapFilter.forEntryDN(BUGS_BUNNY_DN);
+        ToListResultsHandler handler = new ToListResultsHandler();
+        new LdapSearch(conn, ObjectClass.ACCOUNT, filter, handler, new \
OperationOptionsBuilder().build()).execute(); +        assertEquals(1, \
handler.getObjects().size()); +
+        filter = filter.withNativeFilter(&quot;(foo=bar)&quot;);
+        handler = new ToListResultsHandler();
+        new LdapSearch(conn, ObjectClass.ACCOUNT, filter, handler, new \
OperationOptionsBuilder().build()).execute(); +        \
assertTrue(handler.getObjects().isEmpty()); +    }
+
+    @Test
+    public void testLdapFilterWithNonExistingEntryDN() {
+        LdapFilter filter = LdapFilter.forEntryDN(&quot;dc=foo,dc=bar&quot;);
+
+        // VLV index.
+        LdapConfiguration config = newConfiguration();
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(false);
+        searchExpectingNoResult(config, filter);
+
+        // Simple paged results.
+        config = newConfiguration();
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(true);
+        searchExpectingNoResult(config, filter);
+
+        // No paging.
+        config = newConfiguration();
+        config.setUseBlocks(false);
+        searchExpectingNoResult(config, filter);
+    }
+
+
+    @Test
+    public void testLdapFilterWithInvalidEntryDN() {
+        LdapFilter filter = LdapFilter.forEntryDN(&quot;dc=foo,,&quot;);
+
+        // VLV index.
+        LdapConfiguration config = newConfiguration();
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(false);
+        searchExpectingNoResult(config, filter);
+
+        // Simple paged results.
+        config = newConfiguration();
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(true);
+        searchExpectingNoResult(config, filter);
+
+        // No paging.
+        config = newConfiguration();
+        config.setUseBlocks(false);
+        searchExpectingNoResult(config, filter);
+    }
+
+    private void searchExpectingNoResult(LdapConfiguration config, LdapFilter \
filter) { +        LdapConnection conn = new LdapConnection(config);
+        ToListResultsHandler handler = new ToListResultsHandler();
+        // Should not fail with NameNotFoundException or InvalidNameException.
+        new LdapSearch(conn, ObjectClass.ACCOUNT, filter, handler, new \
OperationOptionsBuilder().build()).execute(); +        \
assertTrue(handler.getObjects().isEmpty()); +    }
+
+    @Test
+    public void testCanCancelSearch() {
+        // VLV Index.
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(false);
+        searchExpectingSingleResult(config);
+
+        // Simple paged results.
+        config = newConfiguration();
+        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(true);
+        searchExpectingSingleResult(config);
+
+        // No paging.
+        config = newConfiguration();
+        config.setBaseContexts(ACME_DN, BIG_COMPANY_DN);
+        config.setUseBlocks(false);
+        searchExpectingSingleResult(config);
+    }
+
+    private void searchExpectingSingleResult(LdapConfiguration config) {
+        LdapConnection conn = new LdapConnection(config);
+        FirstOnlyResultsHandler handler = new FirstOnlyResultsHandler();
+        new LdapSearch(conn, ObjectClass.ACCOUNT, null, handler, new \
OperationOptionsBuilder().build()).execute(); +        handler.assertSingleResult();
+    }
+
+    @Test
+    public void testSimplePagedSearch() {
+        LdapConfiguration config = newConfiguration();
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(true);
+        ConnectorFacade facade = newFacade(config);
+
+        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
ObjectClass.ACCOUNT, null); +        assertNotNull(getObjectByName(objects, \
BUGS_BUNNY_DN)); +        assertNotNull(getObjectByName(objects, USER_0_DN));
+        // 1000 is the default search size limit for OpenDS.
+        assertTrue(objects.size() &gt; 1000);
+    }
+
+    @Test
+    public void testVlvIndexSearch() {
+        LdapConfiguration config = newConfiguration();
+        config.setBaseContexts(EXAMPLE_COM_DN);
+        config.setUseBlocks(true);
+        config.setUsePagedResultControl(false);
+        config.setUidAttribute(&quot;entryDN&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
ObjectClass.ACCOUNT, null); +        assertNotNull(getObjectByName(objects, \
USER_0_DN)); +        // 1000 is the default search size limit for OpenDS.
+        assertTrue(objects.size() &gt; 1000);
+
+        // OpenDS-specific.
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;debugsearchindex&quot;);
+        FirstOnlyResultsHandler handler = new FirstOnlyResultsHandler();
+        facade.search(ObjectClass.ACCOUNT, null, handler, builder.build());
+        String debugsearch = \
handler.getSingleResult().getAttributeByName(&quot;debugsearchindex&quot;).getValue().get(0).toString();
 +        assertTrue(debugsearch.contains(&quot;vlv&quot;));
+    }
+
+    @Test(expectedExceptions = ConnectorException.class)
+    public void testNoUseBlocks() {
+        LdapConfiguration config = newConfiguration();
+        config.setUseBlocks(false);
+        ConnectorFacade facade = newFacade(config);
+        // This should fail, since the search will exceed the maximum number of
+        // entries to return.
+        TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null);
+    }
+
+    @Test
+    public void testWithFilter() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        assertEquals(BUGS_BUNNY_DN, \
bunny.getName().getNameValue()); +    }
+
+    @Test
+    public void testWithFilterByBinaryAttribute() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +
+        byte[] photo = { -4, -3, -2, -1, 0, 1, 2, 3, 63, 127 };
+        Attribute photoAttr = AttributeBuilder.build(&quot;jpegPhoto&quot;, photo);
+        Uid newUid = facade.addAttributeValues(ObjectClass.ACCOUNT, bunny.getUid(), \
singleton(photoAttr), null); +
+        ConnectorObject bunnyWithPhoto = searchByAttribute(facade, \
ObjectClass.ACCOUNT, photoAttr, &quot;jpegPhoto&quot;); +        assertEquals(newUid, \
bunnyWithPhoto.getUid()); +    }
+
+    @Test
+    public void testAttributesToGet() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(USER_0_DN), &quot;employeeNumber&quot;, &quot;telephoneNumber&quot;); +
+        Set&lt;Attribute&gt; attrs = newSet(object.getAttributes());
+        assertTrue(attrs.remove(AttributeUtil.find(Uid.NAME, attrs)));
+        assertTrue(attrs.remove(AttributeUtil.find(Name.NAME, attrs)));
+        assertTrue(attrs.remove(AttributeUtil.find(&quot;employeeNumber&quot;, \
attrs))); +        assertTrue(attrs.remove(AttributeUtil.find(&quot;telephoneNumber&quot;, \
attrs))); +
+        assertTrue(attrs.isEmpty());
+    }
+
+    @Test
+    public void testAttributesReturnedByDefaultWithNoValueAreNotReturned() {
+        LdapConfiguration config = newConfiguration(true);
+        ConnectorFacade facade = newFacade(config);
+        AttributeInfo attr = AttributeInfoUtil.find(&quot;givenName&quot;, \
facade.schema().findObjectClassInfo(ObjectClass.ACCOUNT_NAME).getAttributeInfo()); +  \
assertTrue(attr.isReturnedByDefault()); +
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN)); +        \
assertNull(object.getAttributeByName(&quot;givenName&quot;)); +    }
+
+    @Test
+    public void testAttributesToGetNotPresentInEntryAreEmpty() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject object = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN), &quot;employeeNumber&quot;); +
+        assertTrue(object.getAttributeByName(&quot;employeeNumber&quot;).getValue().isEmpty());
 +    }
+
+    @Test
+    public void testScope() {
+        ConnectorFacade facade = newFacade();
+        // Find an organization to pass in OP_CONTAINER.
+        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
+        ConnectorObject organization = searchByAttribute(facade, oclass, new \
Name(BIG_COMPANY_DN)); +
+        // There are no accounts directly under the organization...
+        OperationOptionsBuilder optionsBuilder = new OperationOptionsBuilder();
+        optionsBuilder.setScope(OperationOptions.SCOPE_ONE_LEVEL);
+        optionsBuilder.setContainer(new QualifiedUid(oclass, \
organization.getUid())); +        List&lt;ConnectorObject&gt; objects = \
TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, optionsBuilder.build()); \
+        assertTrue(objects.isEmpty()); +
+        // ... but there are some in the organization subtree.
+        optionsBuilder.setScope(OperationOptions.SCOPE_SUBTREE);
+        objects = TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, \
optionsBuilder.build()); +        assertFalse(objects.isEmpty());
+    }
+
+    @Test
+    public void testAccountSearchFilter() {
+        ConnectorFacade facade = newFacade();
+        // Find an organization to pass in OP_CONTAINER.
+        ObjectClass oclass = new ObjectClass(&quot;organization&quot;);
+        ConnectorObject organization = searchByAttribute(facade, oclass, new \
Name(ACME_DN)); +
+        // First just check that there really are some users.
+        OperationOptionsBuilder optionsBuilder = new OperationOptionsBuilder();
+        optionsBuilder.setScope(OperationOptions.SCOPE_SUBTREE);
+        optionsBuilder.setContainer(new QualifiedUid(oclass, \
organization.getUid())); +        List&lt;ConnectorObject&gt; objects = \
TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, optionsBuilder.build()); \
+        assertNotNull(getObjectByName(objects, BUGS_BUNNY_DN)); +        \
assertNotNull(getObjectByName(objects, ELMER_FUDD_DN)); +
+        LdapConfiguration config = newConfiguration();
+        config.setAccountSearchFilter(&quot;(uid=&quot; + BUGS_BUNNY_UID + \
&quot;)&quot;); +        facade = newFacade(config);
+        objects = TestHelpers.searchToList(facade, ObjectClass.ACCOUNT, null, \
optionsBuilder.build()); +        assertEquals(1, objects.size());
+        assertNotNull(getObjectByName(objects, BUGS_BUNNY_DN));
+    }
+
+    @Test
+    public void testAccountSearchFilterOnlyAppliesToAccounts() {
+        LdapConfiguration config = newConfiguration();
+        config.setAccountSearchFilter(&quot;(cn=foobarbaz)&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        // If the (cn=foobarbaz) filter above applied, the search would return \
nothing. +        assertNotNull(searchByAttribute(facade, new \
ObjectClass(&quot;organization&quot;), new Name(ACME_DN))); +    }
+
+    @Test
+    public void testMissingParenthesesAddedToAccountSearchFilter() {
+        LdapConfiguration config = newConfiguration();
+        config.setAccountSearchFilter(&quot;uid=&quot; + BUGS_BUNNY_UID); // No \
parentheses enclosing the filter. +        ConnectorFacade facade = \
newFacade(config); +
+        // If parentheses were not added, the search would fail.
+        assertNotNull(searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN))); +    }
+
+    @Test
+    public void testMultipleBaseDNs() {
+        ConnectorFacade facade = newFacade();
+
+        // This should find accounts from both base DNs.
+        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, \
ObjectClass.ACCOUNT, null); +        assertNotNull(getObjectByName(objects, \
BUGS_BUNNY_DN)); +        assertNotNull(getObjectByName(objects, USER_0_DN));
+    }
+
+    @Test
+    public void testUidAttributeCn() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;cn&quot;));
+        config.setUidAttribute(&quot;cn&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Uid(BUGS_BUNNY_CN)); +        assertEquals(BUGS_BUNNY_DN, \
bunny.getName().getNameValue()); +    }
+
+    @Test
+    public void testUidAttributeEntryDN() {
+        LdapConfiguration config = newConfiguration();
+        assertFalse(config.getUidAttribute().equalsIgnoreCase(&quot;entryDN&quot;));
+        config.setUidAttribute(&quot;entryDN&quot;);
+        ConnectorFacade facade = newFacade(config);
+
+        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Uid(BUGS_BUNNY_DN)); +        assertEquals(BUGS_BUNNY_DN, \
bunny.getName().getNameValue()); +    }
+
+    @Test
+    public void testSearchArbitraryObjectClass() {
+        ConnectorFacade facade = newFacade();
+
+        // Simplest: try w/o filter.
+        List&lt;ConnectorObject&gt; objects = TestHelpers.searchToList(facade, new \
ObjectClass(&quot;country&quot;), null, null); +        ConnectorObject czechRep = \
getObjectByName(objects, CZECH_REPUBLIC_DN); +
+        // Try with a name filter and options.
+        Filter filter = FilterBuilder.equalTo(AttributeBuilder.build(Name.NAME, \
CZECH_REPUBLIC_DN)); +        OperationOptionsBuilder builder = new \
OperationOptionsBuilder(); +        builder.setAttributesToGet(&quot;c&quot;);
+        objects = TestHelpers.searchToList(facade, new \
ObjectClass(&quot;country&quot;), filter, builder.build()); +        czechRep = \
getObjectByName(objects, CZECH_REPUBLIC_DN); +        assertEquals(CZECH_REPUBLIC_C, \
AttributeUtil.getAsStringValue(czechRep.getAttributeByName(&quot;c&quot;))); +    }
+
+    @Test
+    public void testCannotReturnPasswordFromSearch() {
+        ConnectorFacade facade = newFacade();
+        ConnectorObject bunny = searchByAttribute(facade, ObjectClass.ACCOUNT, new \
Name(BUGS_BUNNY_DN), OperationalAttributes.PASSWORD_NAME); +        GuardedString \
password = (GuardedString) \
bunny.getAttributeByName(OperationalAttributes.PASSWORD_NAME).getValue().get(0); +    \
password.access(new Accessor() { +            public void access(char[] clearChars) {
+                assertEquals(0, clearChars.length);
+            }
+        });
+    }
+
+    private static ConnectorObject getObjectByName(List&lt;ConnectorObject&gt; \
objects, String name) { +        for (ConnectorObject object : objects) {
+            if (name.equals(object.getName().getNameValue())) {
+                return object;
+            }
+        }
+        return null;
+    }
+
+    private static final class FirstOnlyResultsHandler implements ResultsHandler {
+
+        private final List&lt;ConnectorObject&gt; objects = new \
ArrayList&lt;ConnectorObject&gt;(); +
+        public boolean handle(ConnectorObject obj) {
+            objects.add(obj);
+            return false; // We only want the first one.
+        }
+
+        public void assertSingleResult() {
+            assertEquals(1, objects.size());
+        }
+
+        public ConnectorObject getSingleResult() {
+            return objects.get(0);
+        }
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsyncsundsLdapModifyForTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,206 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.sync.sunds;
-
-import org.testng.annotations.Test;
-import static org.identityconnectors.ldap.LdapUtil.quietCreateLdapName;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.ldap.LdapContext;
-import javax.naming.ldap.LdapName;
-import javax.naming.ldap.Rdn;
-
-import org.identityconnectors.common.logging.Log;
-import org.identityconnectors.ldap.LdapConnection;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.ChangeSeparator;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.Line;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.NameValue;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.Separator;
-
-/**
- * A simple, and in no way complete, way to modify an LDAP server
- * based on an LDIF file. 
- */
-public class LdapModifyForTests {
-    
-    private static final Log log = Log.getLog(LdapModifyForTests.class);
-
-    public static void modify(LdapConnection conn, String ldif) throws \
                NamingException {
-        LdifParser parser = new LdifParser(ldif);
-        Iterator&lt;Line&gt; lines = parser.iterator();
-
-        String dn = null;
-        String changeType = null;
-
-        Map&lt;String, List&lt;String&gt;&gt; added = new HashMap&lt;String, \
                List&lt;String&gt;&gt;();
-        Map&lt;String, List&lt;String&gt;&gt; deleted = new HashMap&lt;String, \
                List&lt;String&gt;&gt;();
-        Map&lt;String, List&lt;String&gt;&gt; modifyMap = null;
-
-        String newRdn = null;
-        String deleteOldRdn = &quot;true&quot;;
-
-        while (lines.hasNext()) {
-            Line line = lines.next();
-            if (line instanceof ChangeSeparator &amp;&amp; dn != null) {
-                performChange(conn, dn, changeType, added, deleted, newRdn, \
                deleteOldRdn);
-                dn = null;
-                changeType = null;
-                added.clear();
-                deleted.clear();
-                modifyMap = null;
-                newRdn = null;
-                deleteOldRdn = &quot;true&quot;;
-                continue;
-            }
-            if (dn == null) {
-                NameValue nameValue = (NameValue) line;
-                if (!&quot;dn&quot;.equalsIgnoreCase(nameValue.getName())) {
-                    throw new IllegalArgumentException();
-                }
-                dn = nameValue.getValue();
-                continue;
-            }
-            if (changeType == null) {
-                NameValue nameValue = (NameValue) line;
-                if (!&quot;changeType&quot;.equalsIgnoreCase(nameValue.getName())) {
-                    throw new IllegalArgumentException();
-                }
-                changeType = nameValue.getValue();
-                continue;
-            }
-            if (&quot;add&quot;.equalsIgnoreCase(changeType)) {
-                NameValue nameValue = (NameValue) line;
-                List&lt;String&gt; values = added.get(nameValue.getName());
-                if (values == null) {
-                    values = new ArrayList&lt;String&gt;();
-                    added.put(nameValue.getName(), values);
-                }
-                values.add(nameValue.getValue());
-            } else if (&quot;modify&quot;.equalsIgnoreCase(changeType)) {
-                if (line instanceof Separator) {
-                    modifyMap = null;
-                    continue;
-                }
-                if (modifyMap == null) {
-                    NameValue nameValue = (NameValue) line;
-                    String op = nameValue.getName();
-                    if (&quot;add&quot;.equalsIgnoreCase(op)) {
-                        modifyMap = added;
-                    } else if (&quot;delete&quot;.equalsIgnoreCase(op)) {
-                        modifyMap = deleted;
-                    } else {
-                        throw new IllegalArgumentException();
-                    }
-                    continue;
-                }
-                if (modifyMap != null) {
-                    NameValue nameValue = (NameValue) line;
-                    List&lt;String&gt; values = modifyMap.get(nameValue.getName());
-                    if (values == null) {
-                        values = new ArrayList&lt;String&gt;();
-                        modifyMap.put(nameValue.getName(), values);
-                    }
-                    values.add(nameValue.getValue());
-                }
-            } else if (&quot;modrdn&quot;.equalsIgnoreCase(changeType)) {
-                NameValue nameValue = (NameValue) line;
-                if (&quot;newRdn&quot;.equalsIgnoreCase(nameValue.getName())) {
-                    newRdn = nameValue.getValue();
-                } else if \
                (&quot;deleteOldRdn&quot;.equalsIgnoreCase(nameValue.getName())) {
-                    deleteOldRdn = nameValue.getValue().toLowerCase(Locale.US);
-                }
-            }
-        }
-    }
-
-    private static void performChange(LdapConnection conn, String dn, String \
                changeType,
-            Map&lt;String, List&lt;String&gt;&gt; added, Map&lt;String, \
                List&lt;String&gt;&gt; deleted, String newRdn, String deleteOldRdn)
-            throws NamingException {
-        if (&quot;add&quot;.equalsIgnoreCase(changeType)) {
-            BasicAttributes attrs = new BasicAttributes();
-            for (Entry&lt;String, List&lt;String&gt;&gt; entry : added.entrySet()) {
-                Attribute attr = new BasicAttribute(entry.getKey());
-                for (String each : entry.getValue()) {
-                    attr.add(each);
-                }
-                attrs.put(attr);
-            }
-            LdapName newName = quietCreateLdapName(dn);
-            log.ok(&quot;Creating context {0} with attributes {1}&quot;, newName, \
                attrs);
-            String container = newName.getPrefix(newName.size() - 1).toString();
-            Rdn rdn = newName.getRdn(newName.size() - 1);
-            LdapContext containerCtx = (LdapContext) \
                conn.getInitialContext().lookup(container);
-            containerCtx.createSubcontext(rdn.toString(), attrs);
-        } else if (&quot;modify&quot;.equalsIgnoreCase(changeType)) {
-            List&lt;ModificationItem&gt; modItems = new \
                ArrayList&lt;ModificationItem&gt;();
-            addModificationItems(DirContext.ADD_ATTRIBUTE, added, modItems);
-            addModificationItems(DirContext.REMOVE_ATTRIBUTE, deleted, modItems);
-            log.ok(&quot;Modifying context {0} with attributes {1}&quot;, dn, \
                modItems);
-            conn.getInitialContext().modifyAttributes(dn, modItems.toArray(new \
                ModificationItem[modItems.size()]));
-        } else if (&quot;delete&quot;.equalsIgnoreCase(changeType)) {
-            log.ok(&quot;Deleting context {0}&quot;);
-            conn.getInitialContext().destroySubcontext(dn);
-        } else if (&quot;modrdn&quot;.equalsIgnoreCase(changeType)) {
-            LdapName oldName = quietCreateLdapName(dn);
-            LdapName newName = (LdapName) oldName.getPrefix(oldName.size() - 1);
-            newName.add(newRdn);
-            log.ok(&quot;Renaming context {0} to {1}&quot;, oldName, newName);
-            LdapContext ctx = conn.getInitialContext().newInstance(null);
-            try {
-                ctx.addToEnvironment(&quot;java.naming.ldap.deleteRDN&quot;, \
                deleteOldRdn);
-                ctx.rename(oldName, newName);
-            } finally {
-                ctx.close();
-            }
-        }
-    }
-
-    private static void addModificationItems(int operation, Map&lt;String, \
                List&lt;String&gt;&gt; map, List&lt;ModificationItem&gt; toList) {
-        for (Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) {
-            Attribute attr = new BasicAttribute(entry.getKey());
-            for (String each : entry.getValue()) {
-                attr.add(each);
-            }
-            toList.add(new ModificationItem(operation, attr));
-        }
-    }
-    
-    @Test
-    public void dummy() {
-        // This is here because the class needs to end in &quot;Tests&quot; for it \
                not to be
-        // included in the jar, but then JUnit complains about no runnable methods.
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsyncsundsLda \
pModifyForTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapsyncsundsLdapModifyForTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdapModifyForTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,206 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.sync.sunds;
+
+import org.testng.annotations.Test;
+import static org.identityconnectors.ldap.LdapUtil.quietCreateLdapName;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.ldap.LdapContext;
+import javax.naming.ldap.LdapName;
+import javax.naming.ldap.Rdn;
+
+import org.identityconnectors.common.logging.Log;
+import org.identityconnectors.ldap.LdapConnection;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.ChangeSeparator;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.Line;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.NameValue;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.Separator;
+
+/**
+ * A simple, and in no way complete, way to modify an LDAP server
+ * based on an LDIF file. 
+ */
+public class LdapModifyForTests {
+    
+    private static final Log log = Log.getLog(LdapModifyForTests.class);
+
+    public static void modify(LdapConnection conn, String ldif) throws \
NamingException { +        LdifParser parser = new LdifParser(ldif);
+        Iterator&lt;Line&gt; lines = parser.iterator();
+
+        String dn = null;
+        String changeType = null;
+
+        Map&lt;String, List&lt;String&gt;&gt; added = new HashMap&lt;String, \
List&lt;String&gt;&gt;(); +        Map&lt;String, List&lt;String&gt;&gt; deleted = \
new HashMap&lt;String, List&lt;String&gt;&gt;(); +        Map&lt;String, \
List&lt;String&gt;&gt; modifyMap = null; +
+        String newRdn = null;
+        String deleteOldRdn = &quot;true&quot;;
+
+        while (lines.hasNext()) {
+            Line line = lines.next();
+            if (line instanceof ChangeSeparator &amp;&amp; dn != null) {
+                performChange(conn, dn, changeType, added, deleted, newRdn, \
deleteOldRdn); +                dn = null;
+                changeType = null;
+                added.clear();
+                deleted.clear();
+                modifyMap = null;
+                newRdn = null;
+                deleteOldRdn = &quot;true&quot;;
+                continue;
+            }
+            if (dn == null) {
+                NameValue nameValue = (NameValue) line;
+                if (!&quot;dn&quot;.equalsIgnoreCase(nameValue.getName())) {
+                    throw new IllegalArgumentException();
+                }
+                dn = nameValue.getValue();
+                continue;
+            }
+            if (changeType == null) {
+                NameValue nameValue = (NameValue) line;
+                if (!&quot;changeType&quot;.equalsIgnoreCase(nameValue.getName())) {
+                    throw new IllegalArgumentException();
+                }
+                changeType = nameValue.getValue();
+                continue;
+            }
+            if (&quot;add&quot;.equalsIgnoreCase(changeType)) {
+                NameValue nameValue = (NameValue) line;
+                List&lt;String&gt; values = added.get(nameValue.getName());
+                if (values == null) {
+                    values = new ArrayList&lt;String&gt;();
+                    added.put(nameValue.getName(), values);
+                }
+                values.add(nameValue.getValue());
+            } else if (&quot;modify&quot;.equalsIgnoreCase(changeType)) {
+                if (line instanceof Separator) {
+                    modifyMap = null;
+                    continue;
+                }
+                if (modifyMap == null) {
+                    NameValue nameValue = (NameValue) line;
+                    String op = nameValue.getName();
+                    if (&quot;add&quot;.equalsIgnoreCase(op)) {
+                        modifyMap = added;
+                    } else if (&quot;delete&quot;.equalsIgnoreCase(op)) {
+                        modifyMap = deleted;
+                    } else {
+                        throw new IllegalArgumentException();
+                    }
+                    continue;
+                }
+                if (modifyMap != null) {
+                    NameValue nameValue = (NameValue) line;
+                    List&lt;String&gt; values = modifyMap.get(nameValue.getName());
+                    if (values == null) {
+                        values = new ArrayList&lt;String&gt;();
+                        modifyMap.put(nameValue.getName(), values);
+                    }
+                    values.add(nameValue.getValue());
+                }
+            } else if (&quot;modrdn&quot;.equalsIgnoreCase(changeType)) {
+                NameValue nameValue = (NameValue) line;
+                if (&quot;newRdn&quot;.equalsIgnoreCase(nameValue.getName())) {
+                    newRdn = nameValue.getValue();
+                } else if \
(&quot;deleteOldRdn&quot;.equalsIgnoreCase(nameValue.getName())) { +                  \
deleteOldRdn = nameValue.getValue().toLowerCase(Locale.US); +                }
+            }
+        }
+    }
+
+    private static void performChange(LdapConnection conn, String dn, String \
changeType, +            Map&lt;String, List&lt;String&gt;&gt; added, Map&lt;String, \
List&lt;String&gt;&gt; deleted, String newRdn, String deleteOldRdn) +            \
throws NamingException { +        if (&quot;add&quot;.equalsIgnoreCase(changeType)) {
+            BasicAttributes attrs = new BasicAttributes();
+            for (Entry&lt;String, List&lt;String&gt;&gt; entry : added.entrySet()) {
+                Attribute attr = new BasicAttribute(entry.getKey());
+                for (String each : entry.getValue()) {
+                    attr.add(each);
+                }
+                attrs.put(attr);
+            }
+            LdapName newName = quietCreateLdapName(dn);
+            log.ok(&quot;Creating context {0} with attributes {1}&quot;, newName, \
attrs); +            String container = newName.getPrefix(newName.size() - \
1).toString(); +            Rdn rdn = newName.getRdn(newName.size() - 1);
+            LdapContext containerCtx = (LdapContext) \
conn.getInitialContext().lookup(container); +            \
containerCtx.createSubcontext(rdn.toString(), attrs); +        } else if \
(&quot;modify&quot;.equalsIgnoreCase(changeType)) { +            \
List&lt;ModificationItem&gt; modItems = new ArrayList&lt;ModificationItem&gt;(); +    \
addModificationItems(DirContext.ADD_ATTRIBUTE, added, modItems); +            \
addModificationItems(DirContext.REMOVE_ATTRIBUTE, deleted, modItems); +            \
log.ok(&quot;Modifying context {0} with attributes {1}&quot;, dn, modItems); +        \
conn.getInitialContext().modifyAttributes(dn, modItems.toArray(new \
ModificationItem[modItems.size()])); +        } else if \
(&quot;delete&quot;.equalsIgnoreCase(changeType)) { +            \
log.ok(&quot;Deleting context {0}&quot;); +            \
conn.getInitialContext().destroySubcontext(dn); +        } else if \
(&quot;modrdn&quot;.equalsIgnoreCase(changeType)) { +            LdapName oldName = \
quietCreateLdapName(dn); +            LdapName newName = (LdapName) \
oldName.getPrefix(oldName.size() - 1); +            newName.add(newRdn);
+            log.ok(&quot;Renaming context {0} to {1}&quot;, oldName, newName);
+            LdapContext ctx = conn.getInitialContext().newInstance(null);
+            try {
+                ctx.addToEnvironment(&quot;java.naming.ldap.deleteRDN&quot;, \
deleteOldRdn); +                ctx.rename(oldName, newName);
+            } finally {
+                ctx.close();
+            }
+        }
+    }
+
+    private static void addModificationItems(int operation, Map&lt;String, \
List&lt;String&gt;&gt; map, List&lt;ModificationItem&gt; toList) { +        for \
(Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) { +            \
Attribute attr = new BasicAttribute(entry.getKey()); +            for (String each : \
entry.getValue()) { +                attr.add(each);
+            }
+            toList.add(new ModificationItem(operation, attr));
+        }
+    }
+    
+    @Test
+    public void dummy() {
+        // This is here because the class needs to end in &quot;Tests&quot; for it \
not to be +        // included in the jar, but then JUnit complains about no runnable \
methods. +    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsyncsundsLdifParserTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,94 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.sync.sunds;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import java.util.Iterator;
-
-import org.identityconnectors.ldap.sync.sunds.LdifParser.ChangeSeparator;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.Line;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.NameValue;
-import org.identityconnectors.ldap.sync.sunds.LdifParser.Separator;
-
-public class LdifParserTests {
-
-    @Test
-    public void testSimple() {
-        String ldif =
-                &quot;changeType: mo\n&quot; +
-        		&quot; dify\n&quot; +
-        		&quot;rep\n&quot; +
-        		&quot; lace: cn\n&quot; +
-        		&quot;cn: Na\n&quot; +
-        		&quot; me 1\n&quot; +
-        		&quot;cn: Name 2\n&quot; +
-        		&quot;-\n&quot; +
-        		&quot;\n&quot; +
-        		&quot;\n&quot; +
-        		&quot;c\n&quot; +
-        		&quot; hang\n&quot; +
-        		&quot; eType: add\n&quot; +
-        		&quot;add: \n&quot; +
-        		&quot; uid\n&quot; +
-        		&quot;uid: \n&quot; +
-        		&quot; 1\n&quot; +
-        		&quot;\n&quot; +
-        		&quot;changeType: delete\n&quot;;
-
-        LdifParser parser = new LdifParser(ldif);
-        Iterator&lt;Line&gt; lines = parser.iterator();
-        assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
                &quot;modify&quot;));
-        assertLineEquals(lines.next(), new NameValue(&quot;replace&quot;, \
                &quot;cn&quot;));
-        assertLineEquals(lines.next(), new NameValue(&quot;cn&quot;, &quot;Name \
                1&quot;));
-        assertLineEquals(lines.next(), new NameValue(&quot;cn&quot;, &quot;Name \
                2&quot;));
-        assertTrue(lines.next() instanceof Separator);
-        // LdifParser merges multiple change separators into one.
-        assertTrue(lines.next() instanceof ChangeSeparator);
-        assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
                &quot;add&quot;));
-        assertLineEquals(lines.next(), new NameValue(&quot;add&quot;, \
                &quot;uid&quot;));
-        assertLineEquals(lines.next(), new NameValue(&quot;uid&quot;, \
                &quot;1&quot;));
-        assertTrue(lines.next() instanceof ChangeSeparator);
-        assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
                &quot;delete&quot;));
-        assertTrue(lines.next() instanceof ChangeSeparator);
-    }
-
-    @Test
-    public void testChangeSeparatorAsLastLine() {
-        String ldif =
-            &quot;changeType: modify&quot;;
-
-        LdifParser parser = new LdifParser(ldif);
-        Iterator&lt;Line&gt; lines = parser.iterator();
-        assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
                &quot;modify&quot;));
-        assertTrue(lines.next() instanceof ChangeSeparator);
-    }
-
-    private static void assertLineEquals(Line expected, NameValue value) {
-        assertTrue(expected instanceof NameValue);
-        NameValue expectedValue = (NameValue) expected;
-        assertEquals(expectedValue.getName(), value.getName());
-        assertEquals(expectedValue.getValue(), value.getValue());
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsyncsundsLdi \
fParserTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapsyncsundsLdifParserTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/LdifParserTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.sync.sunds;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import java.util.Iterator;
+
+import org.identityconnectors.ldap.sync.sunds.LdifParser.ChangeSeparator;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.Line;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.NameValue;
+import org.identityconnectors.ldap.sync.sunds.LdifParser.Separator;
+
+public class LdifParserTests {
+
+    @Test
+    public void testSimple() {
+        String ldif =
+                &quot;changeType: mo\n&quot; +
+        		&quot; dify\n&quot; +
+        		&quot;rep\n&quot; +
+        		&quot; lace: cn\n&quot; +
+        		&quot;cn: Na\n&quot; +
+        		&quot; me 1\n&quot; +
+        		&quot;cn: Name 2\n&quot; +
+        		&quot;-\n&quot; +
+        		&quot;\n&quot; +
+        		&quot;\n&quot; +
+        		&quot;c\n&quot; +
+        		&quot; hang\n&quot; +
+        		&quot; eType: add\n&quot; +
+        		&quot;add: \n&quot; +
+        		&quot; uid\n&quot; +
+        		&quot;uid: \n&quot; +
+        		&quot; 1\n&quot; +
+        		&quot;\n&quot; +
+        		&quot;changeType: delete\n&quot;;
+
+        LdifParser parser = new LdifParser(ldif);
+        Iterator&lt;Line&gt; lines = parser.iterator();
+        assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
&quot;modify&quot;)); +        assertLineEquals(lines.next(), new \
NameValue(&quot;replace&quot;, &quot;cn&quot;)); +        \
assertLineEquals(lines.next(), new NameValue(&quot;cn&quot;, &quot;Name 1&quot;)); +  \
assertLineEquals(lines.next(), new NameValue(&quot;cn&quot;, &quot;Name 2&quot;)); +  \
assertTrue(lines.next() instanceof Separator); +        // LdifParser merges multiple \
change separators into one. +        assertTrue(lines.next() instanceof \
ChangeSeparator); +        assertLineEquals(lines.next(), new \
NameValue(&quot;changeType&quot;, &quot;add&quot;)); +        \
assertLineEquals(lines.next(), new NameValue(&quot;add&quot;, &quot;uid&quot;)); +    \
assertLineEquals(lines.next(), new NameValue(&quot;uid&quot;, &quot;1&quot;)); +      \
assertTrue(lines.next() instanceof ChangeSeparator); +        \
assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
&quot;delete&quot;)); +        assertTrue(lines.next() instanceof ChangeSeparator);
+    }
+
+    @Test
+    public void testChangeSeparatorAsLastLine() {
+        String ldif =
+            &quot;changeType: modify&quot;;
+
+        LdifParser parser = new LdifParser(ldif);
+        Iterator&lt;Line&gt; lines = parser.iterator();
+        assertLineEquals(lines.next(), new NameValue(&quot;changeType&quot;, \
&quot;modify&quot;)); +        assertTrue(lines.next() instanceof ChangeSeparator);
+    }
+
+    private static void assertLineEquals(Line expected, NameValue value) {
+        assertTrue(expected instanceof NameValue);
+        NameValue expectedValue = (NameValue) expected;
+        assertEquals(expectedValue.getName(), value.getName());
+        assertEquals(expectedValue.getValue(), value.getValue());
+    }
+}
</ins></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsyncsundsSunDSChangeLogSyncStrategyTestsjava"></a>
 <div class="delfile"><h4>Deleted: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java \
(6871 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java	2015-09-11 \
                09:21:57 UTC (rev 6871)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -1,304 +0,0 @@
</span><del>-/*
- * ====================
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- * 
- * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
- * 
- * The contents of this file are subject to the terms of the Common Development 
- * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
                not use this file 
- * except in compliance with the License.
- * 
- * You can obtain a copy of the License at 
- * http://IdentityConnectors.dev.java.net/legal/license.txt
- * See the License for the specific language governing permissions and limitations 
- * under the License. 
- * 
- * When distributing the Covered Code, include this CDDL Header Notice in each file
- * and include the License file at identityconnectors/legal/license.txt.
- * If applicable, add the following below this CDDL Header, with the fields 
- * enclosed by brackets [] replaced by your own identifying information: 
- * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
- * ====================
- */
-package org.identityconnectors.ldap.sync.sunds;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-import static java.util.Collections.emptyList;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.naming.NamingException;
-
-import org.identityconnectors.common.logging.Log;
-import org.identityconnectors.framework.api.operations.SyncApiOp;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.ObjectClassInfo;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.Schema;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-import org.identityconnectors.framework.common.objects.SyncDeltaType;
-import org.identityconnectors.framework.common.objects.SyncResultsHandler;
-import org.identityconnectors.framework.common.objects.SyncToken;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.identityconnectors.ldap.LdapConfiguration;
-import org.identityconnectors.ldap.LdapConnection;
-import org.identityconnectors.ldap.SunDSTestBase;
-import org.identityconnectors.ldap.LdapConstants.ServerType;
-
-public class SunDSChangeLogSyncStrategyTests extends SunDSTestBase {
-
-    private static final Log log = \
                Log.getLog(SunDSChangeLogSyncStrategyTests.class);
-
-    private static final int STABLE_CHANGELOG_INTERVAL = 2000; /* milliseconds */
-
-    private static LdapConnection newConnection(LdapConfiguration config) throws \
                NamingException {
-        LdapConnection conn = new LdapConnection(config);
-        cleanupBaseContext(conn);
-        waitForChangeLogToStabilize(conn);
-        return conn;
-    }
-
-    private static void waitForChangeLogToStabilize(LdapConnection conn) {
-        int lastChangeNumber = -1;
-        int previousLastChangeNumber;
-        do {
-            if (lastChangeNumber &gt; 0) {
-                log.ok(&quot;Waiting for change log to stabilize (last change \
                number: {0})&quot;, lastChangeNumber);
-                try {
-                    Thread.sleep(STABLE_CHANGELOG_INTERVAL);
-                } catch (InterruptedException e) {
-                    // Ignore.
-                }
-            }
-            previousLastChangeNumber = lastChangeNumber;
-            lastChangeNumber = new SunDSChangeLogSyncStrategy(conn, \
                ObjectClass.ACCOUNT).getChangeLogAttributes().getLastChangeNumber();
-        } while (lastChangeNumber != previousLastChangeNumber);
-    }
-
-    private List&lt;SyncDelta&gt; doTest(LdapConnection conn, String ldif, int \
                expected) throws NamingException {
-        SunDSChangeLogSyncStrategy sync = new SunDSChangeLogSyncStrategy(conn, \
                ObjectClass.ACCOUNT);
-        SyncToken token = sync.getLatestSyncToken();
-
-        LdapModifyForTests.modify(conn, ldif);
-        waitForChangeLogToStabilize(conn);
-
-        OperationOptionsBuilder builder = new OperationOptionsBuilder();
-        builder.setAttributesToGet(&quot;cn&quot;, &quot;sn&quot;, \
                &quot;givenName&quot;, &quot;uid&quot;);
-        OperationOptions options = builder.build();
-
-        final List&lt;SyncDelta&gt; result = new ArrayList&lt;SyncDelta&gt;();
-        sync.sync(token, new SyncResultsHandler() {
-            public boolean handle(SyncDelta delta) {
-                result.add(delta);
-                return true;
-            }
-        }, options);
-        return result;
-    }
-
-    @Test
-    public void testSimple() throws Exception {
-        LdapConnection conn = newConnection(newConfiguration());
-        String baseContext = conn.getConfiguration().getBaseContexts()[0];
-
-        String entryDN = &quot;uid=foobar,&quot; + baseContext;
-        List&lt;SyncDelta&gt; result = doTest(conn,
-                &quot;dn: &quot; +entryDN + &quot;\n&quot; +
-                &quot;changetype: add\n&quot; +
-                &quot;objectClass: inetOrgPerson\n&quot; +
-                &quot;objectClass: organizationalPerson\n&quot; +
-                &quot;objectClass: person\n&quot; +
-                &quot;objectClass: top\n&quot; +
-                &quot;uid: foobar\n&quot; +
-                &quot;cn: Foo Bar\n&quot; +
-                &quot;sn: Bar\n&quot;, 1);
-
-        assertEquals(1, result.size());
-        SyncDelta delta = result.get(0);
-        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
-        ConnectorObject object = delta.getObject();
-        assertEquals(new Uid(entryDN), object.getUid());
-        assertEquals(new Name(entryDN), object.getName());
-        assertEquals(AttributeBuilder.build(&quot;uid&quot;, &quot;foobar&quot;), \
                object.getAttributeByName(&quot;uid&quot;));
-        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;), \
                object.getAttributeByName(&quot;cn&quot;));
-        assertEquals(AttributeBuilder.build(&quot;sn&quot;, &quot;Bar&quot;), \
                object.getAttributeByName(&quot;sn&quot;));
-
-        result = doTest(conn,
-                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
-                &quot;changeType: modrdn\n&quot; +
-                &quot;newRdn: cn=Foo Bar&quot;, 1);
-        entryDN = &quot;cn=Foo Bar,&quot; + baseContext;
-
-        assertEquals(1, result.size());
-        delta = result.get(0);
-        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
-        object = delta.getObject();
-        assertEquals(new Uid(entryDN), object.getUid());
-        assertEquals(new Name(entryDN), object.getName());
-        assertEquals(AttributeBuilder.build(&quot;uid&quot;, emptyList()), \
                object.getAttributeByName(&quot;uid&quot;));
-        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;), \
                object.getAttributeByName(&quot;cn&quot;));
-        assertEquals(AttributeBuilder.build(&quot;sn&quot;, &quot;Bar&quot;), \
                object.getAttributeByName(&quot;sn&quot;));
-
-        result = doTest(conn,
-                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
-                &quot;changeType: modify\n&quot; +
-                &quot;add: cn\n&quot; +
-                &quot;cn: Dummy User&quot;, 1);
-
-        assertEquals(1, result.size());
-        delta = result.get(0);
-        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
-        object = delta.getObject();
-        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;, \
                &quot;Dummy User&quot;), object.getAttributeByName(&quot;cn&quot;));
-
-        result = doTest(conn,
-                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
-                &quot;changeType: modrdn\n&quot; +
-                &quot;newRdn: cn=Dummy User\n&quot; +
-                &quot;deleteOldRdn: FALSE&quot;, 1);
-        entryDN = &quot;cn=Dummy User,&quot; + baseContext;
-
-        assertEquals(1, result.size());
-        delta = result.get(0);
-        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
-        object = delta.getObject();
-        assertEquals(new Uid(entryDN), object.getUid());
-        assertEquals(new Name(entryDN), object.getName());
-        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;, \
                &quot;Dummy User&quot;), object.getAttributeByName(&quot;cn&quot;));
-
-        result = doTest(conn,
-                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
-                &quot;changeType: modify\n&quot; +
-                &quot;delete: cn\n&quot; +
-                &quot;cn: Foo Bar&quot;, 1);
-
-        assertEquals(1, result.size());
-        delta = result.get(0);
-        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
-        object = delta.getObject();
-        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Dummy User&quot;), \
                object.getAttributeByName(&quot;cn&quot;));
-
-        result = doTest(conn,
-                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
-                &quot;changeType: delete&quot;, 1);
-
-        assertEquals(1, result.size());
-        delta = result.get(0);
-        assertEquals(SyncDeltaType.DELETE, delta.getDeltaType());
-        assertEquals(new Uid(entryDN), delta.getUid());
-    }
-
-    @Test
-    public void testAllBlocksReturnedFromSingleSyncCall() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        // Set a small block size so connector would have to do
-        // a couple of searches to return all deltas.
-        config.setChangeLogBlockSize(2);
-        LdapConnection conn = newConnection(config);
-        String baseContext = conn.getConfiguration().getBaseContexts()[0];
-
-        int COUNT = 10;
-        StringBuilder ldif = new StringBuilder();
-        for (int i = 0; i &lt; COUNT; i++) {
-            String name = &quot;user.&quot; + i;
-            String entryDN = &quot;uid=&quot; + name + &quot;,&quot; + baseContext;
-            ldif.append(MessageFormat.format(
-                    &quot;dn: {0}\n&quot; +
-                    &quot;changetype: add\n&quot; +
-                    &quot;objectClass: inetOrgPerson\n&quot; +
-                    &quot;objectClass: organizationalPerson\n&quot; +
-                    &quot;objectClass: person\n&quot; +
-                    &quot;objectClass: top\n&quot; +
-                    &quot;uid: {1}\n&quot; +
-                    &quot;cn: {1}\n&quot; +
-                    &quot;sn: {1}\n&quot; +
-                    &quot;\n&quot;,
-                    entryDN, name));
-        }
-
-        List&lt;SyncDelta&gt; result = doTest(conn, ldif.toString(), COUNT);
-        assertEquals(10, result.size());
-        for (int i = 0; i &lt; COUNT; i++) {
-            String name = &quot;user.&quot; + i;
-            String entryDN = &quot;uid=&quot; + name + &quot;,&quot; + baseContext;
-            ConnectorObject object = result.get(i).getObject();
-            assertEquals(new Uid(entryDN), object.getUid());
-            assertEquals(new Name(entryDN), object.getName());
-        }
-    }
-
-    @Test
-    public void testFilterOutByBaseContexts() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        String baseContext = config.getBaseContexts()[0];
-        config.setBaseContextsToSynchronize(&quot;ou=Subcontext,&quot; + \
                baseContext);
-        LdapConnection conn = newConnection(config);
-        testExpectingNoDelta(conn);
-    }
-
-    @Test
-    public void testFilterOutByModifiersNames() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        config.setModifiersNamesToFilterOut(&quot;cn=Directory Manager&quot;);
-        LdapConnection conn = newConnection(config);
-        testExpectingNoDelta(conn);
-    }
-
-    @Test
-    public void testFilterOutByAttributes() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        config.setAttributesToSynchronize(&quot;telephoneNumber&quot;);
-        LdapConnection conn = newConnection(config);
-        testExpectingNoDelta(conn);
-    }
-
-    @Test
-    public void testFilterOutByObjectClasses() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        config.setObjectClassesToSynchronize(&quot;groupOfUniqueNames&quot;);
-        LdapConnection conn = newConnection(config);
-        testExpectingNoDelta(conn);
-    }
-
-    @Test
-    public void testAccountSynchronizationFilter() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        config.setAccountSynchronizationFilter(&quot;cn=value&quot;);
-        LdapConnection conn = newConnection(config);
-        testExpectingNoDelta(conn);
-    }
-
-    @Test(enabled = false)
-	private void testExpectingNoDelta(LdapConnection conn) throws NamingException {
-        String baseContext = conn.getConfiguration().getBaseContexts()[0];
-        String entryDN = &quot;uid=foobar,&quot; + baseContext;
-        List&lt;SyncDelta&gt; result = doTest(conn,
-                &quot;dn: &quot; +entryDN + &quot;\n&quot; +
-                &quot;changetype: add\n&quot; +
-                &quot;objectClass: inetOrgPerson\n&quot; +
-                &quot;objectClass: organizationalPerson\n&quot; +
-                &quot;objectClass: person\n&quot; +
-                &quot;objectClass: top\n&quot; +
-                &quot;uid: foobar\n&quot; +
-                &quot;cn: Foo Bar\n&quot; +
-                &quot;sn: Bar\n&quot;, 0);
-        assertTrue(result.isEmpty());
-    }
-
-    @Test
-    public void testSyncSupported() throws NamingException {
-        LdapConfiguration config = newConfiguration();
-        LdapConnection conn = newConnection(config);
-        assertEquals(ServerType.SUN_DSEE, conn.getServerType());
-        Schema schema = newFacade(config).schema();
-        ObjectClassInfo accountInfo = \
                schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME);
-        assertTrue(schema.getSupportedObjectClassesByOperation().get(SyncApiOp.class).contains(accountInfo));
                
-    }
-}
</del></span></pre></div>
<a id="tagsopenicfldapconnector1410RC3srctestjavaorgidentityconnectorsldapsyncsundsSun \
DSChangeLogSyncStrategyTestsjavafromrev6872branchesopenicfldapconnector141xsrctestjavaorgidentityconnectorsldapsyncsundsSunDSChangeLogSyncStrategyTestsjava"></a>
 <div class="copfile"><h4>Copied: \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java \
(from rev 6872, branches/openicf-ldap-connector-1.4.1.x/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java) \
(0 => 6874)</h4> <pre class="diff"><span>
<span class="info">--- \
tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java	 \
                (rev 0)
+++ tags/openicf-ldap-connector-1.4.1.0-RC3/src/test/java/org/identityconnectors/ldap/sync/sunds/SunDSChangeLogSyncStrategyTests.java	2015-09-11 \
13:00:13 UTC (rev 6874) </span><span class="lines">@@ -0,0 +1,304 @@
</span><ins>+/*
+ * ====================
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * 
+ * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.     
+ * 
+ * The contents of this file are subject to the terms of the Common Development 
+ * and Distribution License(&quot;CDDL&quot;) (the &quot;License&quot;).  You may \
not use this file  + * except in compliance with the License.
+ * 
+ * You can obtain a copy of the License at 
+ * http://IdentityConnectors.dev.java.net/legal/license.txt
+ * See the License for the specific language governing permissions and limitations 
+ * under the License. 
+ * 
+ * When distributing the Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at identityconnectors/legal/license.txt.
+ * If applicable, add the following below this CDDL Header, with the fields 
+ * enclosed by brackets [] replaced by your own identifying information: 
+ * &quot;Portions Copyrighted [year] [name of copyright owner]&quot;
+ * ====================
+ */
+package org.identityconnectors.ldap.sync.sunds;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+import static java.util.Collections.emptyList;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingException;
+
+import org.identityconnectors.common.logging.Log;
+import org.identityconnectors.framework.api.operations.SyncApiOp;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.ObjectClassInfo;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.Schema;
+import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.identityconnectors.framework.common.objects.SyncDeltaType;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
+import org.identityconnectors.framework.common.objects.SyncToken;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.identityconnectors.ldap.LdapConfiguration;
+import org.identityconnectors.ldap.LdapConnection;
+import org.identityconnectors.ldap.SunDSTestBase;
+import org.identityconnectors.ldap.LdapConstants.ServerType;
+
+public class SunDSChangeLogSyncStrategyTests extends SunDSTestBase {
+
+    private static final Log log = \
Log.getLog(SunDSChangeLogSyncStrategyTests.class); +
+    private static final int STABLE_CHANGELOG_INTERVAL = 2000; /* milliseconds */
+
+    private static LdapConnection newConnection(LdapConfiguration config) throws \
NamingException { +        LdapConnection conn = new LdapConnection(config);
+        cleanupBaseContext(conn);
+        waitForChangeLogToStabilize(conn);
+        return conn;
+    }
+
+    private static void waitForChangeLogToStabilize(LdapConnection conn) {
+        int lastChangeNumber = -1;
+        int previousLastChangeNumber;
+        do {
+            if (lastChangeNumber &gt; 0) {
+                log.ok(&quot;Waiting for change log to stabilize (last change \
number: {0})&quot;, lastChangeNumber); +                try {
+                    Thread.sleep(STABLE_CHANGELOG_INTERVAL);
+                } catch (InterruptedException e) {
+                    // Ignore.
+                }
+            }
+            previousLastChangeNumber = lastChangeNumber;
+            lastChangeNumber = new SunDSChangeLogSyncStrategy(conn, \
ObjectClass.ACCOUNT).getChangeLogAttributes().getLastChangeNumber(); +        } while \
(lastChangeNumber != previousLastChangeNumber); +    }
+
+    private List&lt;SyncDelta&gt; doTest(LdapConnection conn, String ldif, int \
expected) throws NamingException { +        SunDSChangeLogSyncStrategy sync = new \
SunDSChangeLogSyncStrategy(conn, ObjectClass.ACCOUNT); +        SyncToken token = \
sync.getLatestSyncToken(); +
+        LdapModifyForTests.modify(conn, ldif);
+        waitForChangeLogToStabilize(conn);
+
+        OperationOptionsBuilder builder = new OperationOptionsBuilder();
+        builder.setAttributesToGet(&quot;cn&quot;, &quot;sn&quot;, \
&quot;givenName&quot;, &quot;uid&quot;); +        OperationOptions options = \
builder.build(); +
+        final List&lt;SyncDelta&gt; result = new ArrayList&lt;SyncDelta&gt;();
+        sync.sync(token, new SyncResultsHandler() {
+            public boolean handle(SyncDelta delta) {
+                result.add(delta);
+                return true;
+            }
+        }, options);
+        return result;
+    }
+
+    @Test
+    public void testSimple() throws Exception {
+        LdapConnection conn = newConnection(newConfiguration());
+        String baseContext = conn.getConfiguration().getBaseContexts()[0];
+
+        String entryDN = &quot;uid=foobar,&quot; + baseContext;
+        List&lt;SyncDelta&gt; result = doTest(conn,
+                &quot;dn: &quot; +entryDN + &quot;\n&quot; +
+                &quot;changetype: add\n&quot; +
+                &quot;objectClass: inetOrgPerson\n&quot; +
+                &quot;objectClass: organizationalPerson\n&quot; +
+                &quot;objectClass: person\n&quot; +
+                &quot;objectClass: top\n&quot; +
+                &quot;uid: foobar\n&quot; +
+                &quot;cn: Foo Bar\n&quot; +
+                &quot;sn: Bar\n&quot;, 1);
+
+        assertEquals(1, result.size());
+        SyncDelta delta = result.get(0);
+        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
+        ConnectorObject object = delta.getObject();
+        assertEquals(new Uid(entryDN), object.getUid());
+        assertEquals(new Name(entryDN), object.getName());
+        assertEquals(AttributeBuilder.build(&quot;uid&quot;, &quot;foobar&quot;), \
object.getAttributeByName(&quot;uid&quot;)); +        \
assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;), \
object.getAttributeByName(&quot;cn&quot;)); +        \
assertEquals(AttributeBuilder.build(&quot;sn&quot;, &quot;Bar&quot;), \
object.getAttributeByName(&quot;sn&quot;)); +
+        result = doTest(conn,
+                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
+                &quot;changeType: modrdn\n&quot; +
+                &quot;newRdn: cn=Foo Bar&quot;, 1);
+        entryDN = &quot;cn=Foo Bar,&quot; + baseContext;
+
+        assertEquals(1, result.size());
+        delta = result.get(0);
+        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
+        object = delta.getObject();
+        assertEquals(new Uid(entryDN), object.getUid());
+        assertEquals(new Name(entryDN), object.getName());
+        assertEquals(AttributeBuilder.build(&quot;uid&quot;, emptyList()), \
object.getAttributeByName(&quot;uid&quot;)); +        \
assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;), \
object.getAttributeByName(&quot;cn&quot;)); +        \
assertEquals(AttributeBuilder.build(&quot;sn&quot;, &quot;Bar&quot;), \
object.getAttributeByName(&quot;sn&quot;)); +
+        result = doTest(conn,
+                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
+                &quot;changeType: modify\n&quot; +
+                &quot;add: cn\n&quot; +
+                &quot;cn: Dummy User&quot;, 1);
+
+        assertEquals(1, result.size());
+        delta = result.get(0);
+        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
+        object = delta.getObject();
+        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;, \
&quot;Dummy User&quot;), object.getAttributeByName(&quot;cn&quot;)); +
+        result = doTest(conn,
+                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
+                &quot;changeType: modrdn\n&quot; +
+                &quot;newRdn: cn=Dummy User\n&quot; +
+                &quot;deleteOldRdn: FALSE&quot;, 1);
+        entryDN = &quot;cn=Dummy User,&quot; + baseContext;
+
+        assertEquals(1, result.size());
+        delta = result.get(0);
+        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
+        object = delta.getObject();
+        assertEquals(new Uid(entryDN), object.getUid());
+        assertEquals(new Name(entryDN), object.getName());
+        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Foo Bar&quot;, \
&quot;Dummy User&quot;), object.getAttributeByName(&quot;cn&quot;)); +
+        result = doTest(conn,
+                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
+                &quot;changeType: modify\n&quot; +
+                &quot;delete: cn\n&quot; +
+                &quot;cn: Foo Bar&quot;, 1);
+
+        assertEquals(1, result.size());
+        delta = result.get(0);
+        assertEquals(SyncDeltaType.CREATE_OR_UPDATE, delta.getDeltaType());
+        object = delta.getObject();
+        assertEquals(AttributeBuilder.build(&quot;cn&quot;, &quot;Dummy User&quot;), \
object.getAttributeByName(&quot;cn&quot;)); +
+        result = doTest(conn,
+                &quot;dn: &quot; + entryDN + &quot;\n&quot; +
+                &quot;changeType: delete&quot;, 1);
+
+        assertEquals(1, result.size());
+        delta = result.get(0);
+        assertEquals(SyncDeltaType.DELETE, delta.getDeltaType());
+        assertEquals(new Uid(entryDN), delta.getUid());
+    }
+
+    @Test
+    public void testAllBlocksReturnedFromSingleSyncCall() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        // Set a small block size so connector would have to do
+        // a couple of searches to return all deltas.
+        config.setChangeLogBlockSize(2);
+        LdapConnection conn = newConnection(config);
+        String baseContext = conn.getConfiguration().getBaseContexts()[0];
+
+        int COUNT = 10;
+        StringBuilder ldif = new StringBuilder();
+        for (int i = 0; i &lt; COUNT; i++) {
+            String name = &quot;user.&quot; + i;
+            String entryDN = &quot;uid=&quot; + name + &quot;,&quot; + baseContext;
+            ldif.append(MessageFormat.format(
+                    &quot;dn: {0}\n&quot; +
+                    &quot;changetype: add\n&quot; +
+                    &quot;objectClass: inetOrgPerson\n&quot; +
+                    &quot;objectClass: organizationalPerson\n&quot; +
+                    &quot;objectClass: person\n&quot; +
+                    &quot;objectClass: top\n&quot; +
+                    &quot;uid: {1}\n&quot; +
+                    &quot;cn: {1}\n&quot; +
+                    &quot;sn: {1}\n&quot; +
+                    &quot;\n&quot;,
+                    entryDN, name));
+        }
+
+        List&lt;SyncDelta&gt; result = doTest(conn, ldif.toString(), COUNT);
+        assertEquals(10, result.size());
+        for (int i = 0; i &lt; COUNT; i++) {
+            String name = &quot;user.&quot; + i;
+            String entryDN = &quot;uid=&quot; + name + &quot;,&quot; + baseContext;
+            ConnectorObject object = result.get(i).getObject();
+            assertEquals(new Uid(entryDN), object.getUid());
+            assertEquals(new Name(entryDN), object.getName());
+        }
+    }
+
+    @Test
+    public void testFilterOutByBaseContexts() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        String baseContext = config.getBaseContexts()[0];
+        config.setBaseContextsToSynchronize(&quot;ou=Subcontext,&quot; + \
baseContext); +        LdapConnection conn = newConnection(config);
+        testExpectingNoDelta(conn);
+    }
+
+    @Test
+    public void testFilterOutByModifiersNames() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        config.setModifiersNamesToFilterOut(&quot;cn=Directory Manager&quot;);
+        LdapConnection conn = newConnection(config);
+        testExpectingNoDelta(conn);
+    }
+
+    @Test
+    public void testFilterOutByAttributes() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        config.setAttributesToSynchronize(&quot;telephoneNumber&quot;);
+        LdapConnection conn = newConnection(config);
+        testExpectingNoDelta(conn);
+    }
+
+    @Test
+    public void testFilterOutByObjectClasses() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        config.setObjectClassesToSynchronize(&quot;groupOfUniqueNames&quot;);
+        LdapConnection conn = newConnection(config);
+        testExpectingNoDelta(conn);
+    }
+
+    @Test
+    public void testAccountSynchronizationFilter() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        config.setAccountSynchronizationFilter(&quot;cn=value&quot;);
+        LdapConnection conn = newConnection(config);
+        testExpectingNoDelta(conn);
+    }
+
+    @Test(enabled = false)
+	private void testExpectingNoDelta(LdapConnection conn) throws NamingException {
+        String baseContext = conn.getConfiguration().getBaseContexts()[0];
+        String entryDN = &quot;uid=foobar,&quot; + baseContext;
+        List&lt;SyncDelta&gt; result = doTest(conn,
+                &quot;dn: &quot; +entryDN + &quot;\n&quot; +
+                &quot;changetype: add\n&quot; +
+                &quot;objectClass: inetOrgPerson\n&quot; +
+                &quot;objectClass: organizationalPerson\n&quot; +
+                &quot;objectClass: person\n&quot; +
+                &quot;objectClass: top\n&quot; +
+                &quot;uid: foobar\n&quot; +
+                &quot;cn: Foo Bar\n&quot; +
+                &quot;sn: Bar\n&quot;, 0);
+        assertTrue(result.isEmpty());
+    }
+
+    @Test
+    public void testSyncSupported() throws NamingException {
+        LdapConfiguration config = newConfiguration();
+        LdapConnection conn = newConnection(config);
+        assertEquals(ServerType.SUN_DSEE, conn.getServerType());
+        Schema schema = newFacade(config).schema();
+        ObjectClassInfo accountInfo = \
schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME); +        \
assertTrue(schema.getSupportedObjectClassesByOperation().get(SyncApiOp.class).contains(accountInfo));
 +    }
+}
</ins></span></pre>
</div>
</div>
<div id="footer">Copyright (c) by ForgeRock. All rights reserved.</div>

</body>
</html>



_______________________________________________
Commitopenicf mailing list
Commitopenicf@forgerock.org
https://lists.forgerock.org/mailman/listinfo/commitopenicf


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic