You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/05/06 16:25:20 UTC
svn commit: r1334639 [4/5] - in
/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server:
operations/add/ operations/bind/ operations/compare/ operations/delete/
operations/extended/ operations/ldapsdk/ operations/lookup/ operat...
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -54,7 +54,7 @@ import org.junit.runner.RunWith;
/**
- * A set of tests to make sure the negation operator is working
+ * A set of tests to make sure the negation operator is working
* properly when included in search filters on indexed attributes.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -152,111 +152,111 @@ extendedOpHandlers =
})
public class IndexedNegationSearchIT extends AbstractLdapTestUnit
{
-@Rule
-public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.THREADSAFE );
-
-
-/**
- * Tests to make sure a negated search for OU of "test1" returns
- * those entries that do not have the OU attribute or do not have
- * a "test1" value for OU if the attribute exists.
- */
-@Test
-public void testSearchNotOUIndexed() throws Exception
-{
- Set<SearchResult> results = getResults( "(!(ou=test1))" );
- assertFalse( contains( "uid=test1,ou=test,ou=system", results ) );
- assertTrue( contains( "uid=test2,ou=test,ou=system", results ) );
- assertTrue( contains( "uid=testNoOU,ou=test,ou=system", results ) );
-}
-
-
-/**
- * Tests to make sure a negated search for actors without ou
- * with value 'drama' returns those that do not have the attribute
- * and do not have a 'drama' value for ou if the attribute still
- * exists. This test DOES build an index on ou for the system
- * partition and should have failed if the bug in DIRSERVER-951
- * was present and reproducable.
- */
-@Test
-public void testSearchNotDramaIndexed() throws Exception
-{
- // jack black has ou but not drama, and joe newbie has no ou what so ever
- Set<SearchResult> results = getActorResults( "(!(ou=drama))" );
- assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
- assertTrue( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
- assertEquals( 2, results.size() );
-}
-
-
-boolean contains( String dn, Set<SearchResult> results )
-{
- for ( SearchResult result : results )
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
+
+
+ /**
+ * Tests to make sure a negated search for OU of "test1" returns
+ * those entries that do not have the OU attribute or do not have
+ * a "test1" value for OU if the attribute exists.
+ */
+ @Test
+ public void testSearchNotOUIndexed() throws Exception
{
- if ( result.getNameInNamespace().equals( dn ) )
+ Set<SearchResult> results = getResults( "(!(ou=test1))" );
+ assertFalse( contains( "uid=test1,ou=test,ou=system", results ) );
+ assertTrue( contains( "uid=test2,ou=test,ou=system", results ) );
+ assertTrue( contains( "uid=testNoOU,ou=test,ou=system", results ) );
+ }
+
+
+ /**
+ * Tests to make sure a negated search for actors without ou
+ * with value 'drama' returns those that do not have the attribute
+ * and do not have a 'drama' value for ou if the attribute still
+ * exists. This test DOES build an index on ou for the system
+ * partition and should have failed if the bug in DIRSERVER-951
+ * was present and reproducable.
+ */
+ @Test
+ public void testSearchNotDramaIndexed() throws Exception
+ {
+ // jack black has ou but not drama, and joe newbie has no ou what so ever
+ Set<SearchResult> results = getActorResults( "(!(ou=drama))" );
+ assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
+ assertTrue( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 2, results.size() );
+ }
+
+
+ boolean contains( String dn, Set<SearchResult> results )
+ {
+ for ( SearchResult result : results )
{
- return true;
+ if ( result.getNameInNamespace().equals( dn ) )
+ {
+ return true;
+ }
}
+
+ return false;
}
-
- return false;
-}
-
-
-/**
- * Tests to make sure a negated search for actors without ou
- * with value 'drama' returns those that do not have the attribute
- * and do not have a 'drama' value for ou if the attribute still
- * exists. This test DOES build an index on ou for the system
- * partition and should have failed if the bug in DIRSERVER-951
- * was present and reproducable.
- */
-@Test
-public void testSearchNotDramaNotNewbieIndexed() throws Exception
-{
- // jack black has ou but not drama, and joe newbie has no ou what so ever
- Set<SearchResult> results = getActorResults( "(& (!(uid=jnewbie)) (!(ou=drama)) )" );
- assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
- assertFalse( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
- assertEquals( 1, results.size() );
-}
-
-
-Set<SearchResult> getActorResults( String filter ) throws Exception
-{
- DirContext ctx = getWiredContext( getLdapServer() );
- Set<SearchResult> results = new HashSet<SearchResult>();
- SearchControls controls = new SearchControls();
- controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
- NamingEnumeration<SearchResult> namingEnumeration = ctx.search( "ou=actors,ou=system", filter, controls );
- while ( namingEnumeration.hasMore() )
+
+
+ /**
+ * Tests to make sure a negated search for actors without ou
+ * with value 'drama' returns those that do not have the attribute
+ * and do not have a 'drama' value for ou if the attribute still
+ * exists. This test DOES build an index on ou for the system
+ * partition and should have failed if the bug in DIRSERVER-951
+ * was present and reproducable.
+ */
+ @Test
+ public void testSearchNotDramaNotNewbieIndexed() throws Exception
{
- results.add( namingEnumeration.next() );
+ // jack black has ou but not drama, and joe newbie has no ou what so ever
+ Set<SearchResult> results = getActorResults( "(& (!(uid=jnewbie)) (!(ou=drama)) )" );
+ assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
+ assertFalse( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 1, results.size() );
}
-
- namingEnumeration.close();
- ctx.close();
-
- return results;
-}
-
-
-Set<SearchResult> getResults( String filter ) throws Exception
-{
- DirContext ctx = getWiredContext( getLdapServer() );
- Set<SearchResult> results = new HashSet<SearchResult>();
- SearchControls controls = new SearchControls();
- controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<SearchResult> namingEnumeration = ctx.search( "ou=system", filter, controls );
- while ( namingEnumeration.hasMore() )
+
+
+ Set<SearchResult> getActorResults( String filter ) throws Exception
{
- results.add( namingEnumeration.next() );
+ DirContext ctx = getWiredContext( getLdapServer() );
+ Set<SearchResult> results = new HashSet<SearchResult>();
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ NamingEnumeration<SearchResult> namingEnumeration = ctx.search( "ou=actors,ou=system", filter, controls );
+ while ( namingEnumeration.hasMore() )
+ {
+ results.add( namingEnumeration.next() );
+ }
+
+ namingEnumeration.close();
+ ctx.close();
+
+ return results;
+ }
+
+
+ Set<SearchResult> getResults( String filter ) throws Exception
+ {
+ DirContext ctx = getWiredContext( getLdapServer() );
+ Set<SearchResult> results = new HashSet<SearchResult>();
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+ NamingEnumeration<SearchResult> namingEnumeration = ctx.search( "ou=system", filter, controls );
+ while ( namingEnumeration.hasMore() )
+ {
+ results.add( namingEnumeration.next() );
+ }
+
+ namingEnumeration.close();
+ ctx.close();
+
+ return results;
}
-
- namingEnumeration.close();
- ctx.close();
-
- return results;
-}
}
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/NegationSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/NegationSearchIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/NegationSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/NegationSearchIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -45,9 +45,9 @@ import org.junit.runner.RunWith;
/**
- * A set of tests to make sure the negation operator is working
+ * A set of tests to make sure the negation operator is working
* properly when included in search filters. Created in response
- * to JIRA issue
+ * to JIRA issue
* <a href="https://issues.apache.org/jira/browse/DIRSERVER-951">DIRSERVER-951</a>.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -109,75 +109,75 @@ import org.junit.runner.RunWith;
})
public class NegationSearchIT extends AbstractLdapTestUnit
{
-@Rule
-public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.THREADSAFE );
-
-
-/**
- * Tests to make sure a negated search for actors without ou
- * with value 'drama' returns those that do not have the attribute
- * and do not have a 'drama' value for ou if the attribute still
- * exists. This test does not build an index on ou for the system
- * partition.
- */
-@Test
-public void testSearchNotDrama() throws Exception
-{
- // jack black has ou but not drama, and joe newbie has no ou what so ever
- Set<SearchResult> results = getResults( "(!(ou=drama))" );
- assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
- assertTrue( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
- assertEquals( 2, results.size() );
-}
-
-
-/**
- * Tests to make sure a negated search for actors without ou
- * with value 'drama' returns those that do not have the attribute
- * and do not have a 'drama' value for ou if the attribute still
- * exists. This test does not build an index on ou for the system
- * partition.
- */
-@Test
-public void testSearchNotDramaNotNewbie() throws Exception
-{
- // jack black has ou but not drama, and joe newbie has no ou what so ever
- Set<SearchResult> results = getResults( "(& (!(uid=jnewbie)) (!(ou=drama)) )" );
- assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
- assertFalse( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
- assertEquals( 1, results.size() );
-}
-
-
-boolean contains( String dn, Set<SearchResult> results )
-{
- for ( SearchResult result : results )
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
+
+
+ /**
+ * Tests to make sure a negated search for actors without ou
+ * with value 'drama' returns those that do not have the attribute
+ * and do not have a 'drama' value for ou if the attribute still
+ * exists. This test does not build an index on ou for the system
+ * partition.
+ */
+ @Test
+ public void testSearchNotDrama() throws Exception
+ {
+ // jack black has ou but not drama, and joe newbie has no ou what so ever
+ Set<SearchResult> results = getResults( "(!(ou=drama))" );
+ assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
+ assertTrue( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 2, results.size() );
+ }
+
+
+ /**
+ * Tests to make sure a negated search for actors without ou
+ * with value 'drama' returns those that do not have the attribute
+ * and do not have a 'drama' value for ou if the attribute still
+ * exists. This test does not build an index on ou for the system
+ * partition.
+ */
+ @Test
+ public void testSearchNotDramaNotNewbie() throws Exception
{
- if ( result.getNameInNamespace().equals( dn ) )
+ // jack black has ou but not drama, and joe newbie has no ou what so ever
+ Set<SearchResult> results = getResults( "(& (!(uid=jnewbie)) (!(ou=drama)) )" );
+ assertTrue( contains( "uid=jblack,ou=actors,ou=system", results ) );
+ assertFalse( contains( "uid=jnewbie,ou=actors,ou=system", results ) );
+ assertEquals( 1, results.size() );
+ }
+
+
+ boolean contains( String dn, Set<SearchResult> results )
+ {
+ for ( SearchResult result : results )
{
- return true;
+ if ( result.getNameInNamespace().equals( dn ) )
+ {
+ return true;
+ }
}
+
+ return false;
}
-
- return false;
-}
-
-
-Set<SearchResult> getResults( String filter ) throws Exception
-{
- DirContext ctx = getWiredContext( getLdapServer() );
- Set<SearchResult> results = new HashSet<SearchResult>();
- SearchControls controls = new SearchControls();
- controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
- NamingEnumeration<SearchResult> namingEnumeration = ctx.search( "ou=actors,ou=system", filter, controls );
- while ( namingEnumeration.hasMore() )
+
+
+ Set<SearchResult> getResults( String filter ) throws Exception
{
- results.add( namingEnumeration.next() );
+ DirContext ctx = getWiredContext( getLdapServer() );
+ Set<SearchResult> results = new HashSet<SearchResult>();
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ NamingEnumeration<SearchResult> namingEnumeration = ctx.search( "ou=actors,ou=system", filter, controls );
+ while ( namingEnumeration.hasMore() )
+ {
+ results.add( namingEnumeration.next() );
+ }
+
+ namingEnumeration.close();
+ ctx.close();
+
+ return results;
}
-
- namingEnumeration.close();
- ctx.close();
-
- return results;
-}
}
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -180,7 +180,7 @@ import org.junit.runner.RunWith;
"objectClass: person",
"cn: user8",
"sn: user 8",
- //
+ //
"dn: cn=user9,dc=users,ou=system",
"objectClass: top",
"objectClass: person",
@@ -198,7 +198,7 @@ import org.junit.runner.RunWith;
public class PagedSearchIT extends AbstractLdapTestUnit
{
@Rule
- public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.THREADSAFE );
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
private LdapApiService codec = LdapApiServiceFactory.getSingleton();
@@ -1083,7 +1083,7 @@ public class PagedSearchIT extends Abstr
/**
- * Do a test with a paged search, changing the number of entries to
+ * Do a test with a paged search, changing the number of entries to
* return in the middle of the loop
*/
@Test
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -43,6 +43,7 @@ import javax.naming.event.ObjectChangeLi
import javax.naming.ldap.HasControls;
import javax.naming.ldap.LdapContext;
+import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -63,6 +64,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.PersistentSearchImpl;
import org.apache.directory.shared.ldap.util.JndiUtils;
import org.junit.After;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@@ -92,573 +94,575 @@ import org.slf4j.LoggerFactory;
})
public class PersistentSearchIT extends AbstractLdapTestUnit
{
-private static final Logger LOG = LoggerFactory.getLogger( PersistentSearchIT.class );
-
-private static final String BASE = "ou=system";
-private static final String PERSON_DESCRIPTION = "an American singer-songwriter";
-private static final String RDN = "cn=Tori Amos";
-
-
-/**
- * Creation of required attributes of a person entry.
- */
-private Attributes getPersonAttributes( String sn, String cn ) throws LdapException
-{
- Attributes attributes = LdifUtils.createJndiAttributes(
- "objectClass: top",
- "objectClass: person",
- "cn", cn,
- "sn", sn );
-
- return attributes;
-}
-
-EventDirContext ctx;
-EventService eventService;
-PSearchListener listener;
-Thread t;
-
-
-private void setUpListenerReturnECs() throws Exception
-{
- setUpListener( true, new PersistentSearchImpl(), false );
-}
-
-
-private void setUpListener( boolean returnECs, PersistentSearch persistentSearch, boolean ignoreEmptyRegistryCheck )
- throws Exception
-{
- ctx = ( EventDirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
- eventService = getLdapServer().getDirectoryService().getEventService();
- List<RegistrationEntry> registrationEntryList = eventService.getRegistrationEntries();
-
- if ( !ignoreEmptyRegistryCheck )
- {
- assertTrue( registrationEntryList.isEmpty() );
- }
-
- persistentSearch.setReturnECs( returnECs );
- listener = new PSearchListener( persistentSearch );
- t = new Thread( listener, "PSearchListener" );
- t.start();
-
- // let's wait until the listener thread started
- while ( eventService.getRegistrationEntries().isEmpty() )
- {
- Thread.sleep( 100 );
- }
-
- // Now we wait until the listener is registered (timing dependent crap)
- Thread.sleep( 250 );
-}
-
-
-private void setUpListener() throws Exception
-{
- ctx = ( EventDirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
- eventService = getLdapServer().getDirectoryService().getEventService();
- List<RegistrationEntry> registrationEntryList = eventService.getRegistrationEntries();
- assertTrue( registrationEntryList.isEmpty() );
-
- listener = new PSearchListener();
- t = new Thread( listener, "PSearchListener" );
- t.start();
-
- // let's wait until the listener thread started
- while ( eventService.getRegistrationEntries().isEmpty() )
- {
- Thread.sleep( 100 );
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
+ private static final Logger LOG = LoggerFactory.getLogger( PersistentSearchIT.class );
+
+ private static final String BASE = "ou=system";
+ private static final String PERSON_DESCRIPTION = "an American singer-songwriter";
+ private static final String RDN = "cn=Tori Amos";
+
+
+ /**
+ * Creation of required attributes of a person entry.
+ */
+ private Attributes getPersonAttributes( String sn, String cn ) throws LdapException
+ {
+ Attributes attributes = LdifUtils.createJndiAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn", cn,
+ "sn", sn );
+
+ return attributes;
}
-
- // Now we wait until the listener is registered (timing dependent crap)
- Thread.sleep( 250 );
-}
-
-
-@After
-public void tearDownListener() throws Exception
-{
- listener.close();
- ctx.close();
-
- while ( !eventService.getRegistrationEntries().isEmpty() )
+
+ EventDirContext ctx;
+ EventService eventService;
+ PSearchListener listener;
+ Thread t;
+
+
+ private void setUpListenerReturnECs() throws Exception
{
- Thread.sleep( 100 );
+ setUpListener( true, new PersistentSearchImpl(), false );
}
-}
-
-
-private void waitForThreadToDie( Thread t ) throws Exception
-{
- long start = System.currentTimeMillis();
-
- while ( t.isAlive() )
+
+
+ private void setUpListener( boolean returnECs, PersistentSearch persistentSearch, boolean ignoreEmptyRegistryCheck )
+ throws Exception
{
- Thread.sleep( 200 );
- if ( System.currentTimeMillis() - start > 1000 )
+ ctx = ( EventDirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+ eventService = getLdapServer().getDirectoryService().getEventService();
+ List<RegistrationEntry> registrationEntryList = eventService.getRegistrationEntries();
+
+ if ( !ignoreEmptyRegistryCheck )
{
- break;
+ assertTrue( registrationEntryList.isEmpty() );
}
+
+ persistentSearch.setReturnECs( returnECs );
+ listener = new PSearchListener( persistentSearch );
+ t = new Thread( listener, "PSearchListener" );
+ t.start();
+
+ // let's wait until the listener thread started
+ while ( eventService.getRegistrationEntries().isEmpty() )
+ {
+ Thread.sleep( 100 );
+ }
+
+ // Now we wait until the listener is registered (timing dependent crap)
+ Thread.sleep( 250 );
}
-}
-
-
-/**
- * Shows correct notifications for modify(4) changes.
- */
-@Test
-public void testPsearchModify() throws Exception
-{
- setUpListener();
- ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE,
- new BasicAttributes( "description", PERSON_DESCRIPTION, true ) );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( RDN, listener.result.getName() );
-}
-
-
-/**
- * Shows correct notifications for moddn(8) changes.
- */
-@Test
-public void testPsearchModifyDn() throws Exception
-{
- setUpListener();
- ctx.rename( RDN, "cn=Jack Black" );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
-}
-
-
-/**
- * Shows correct notifications for delete(2) changes.
- */
-@Test
-public void testPsearchDelete() throws Exception
-{
- setUpListener();
- ctx.destroySubcontext( RDN );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( RDN, listener.result.getName() );
-}
-
-
-/**
- * Shows correct notifications for add(1) changes.
- */
-@Test
-public void testPsearchAdd() throws Exception
-{
- setUpListener();
- ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
-}
-
-
-/**
- * Shows correct notifications for modify(4) changes with returned
- * EntryChangeControl.
- */
-@Test
-public void testPsearchModifyWithEC() throws Exception
-{
- setUpListenerReturnECs();
- ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, new BasicAttributes( "description", PERSON_DESCRIPTION,
- true ) );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( RDN, listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
-}
-
-
-/**
- * Shows correct notifications for moddn(8) changes with returned
- * EntryChangeControl.
- */
-@Test
-public void testPsearchModifyDnWithEC() throws Exception
-{
- setUpListenerReturnECs();
- ctx.rename( RDN, "cn=Jack Black" );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.MODDN );
- assertEquals( ( RDN + ",ou=system" ), listener.result.control.getPreviousDn().getName() );
-}
-
-
-/**
- * Shows correct notifications for delete(2) changes with returned
- * EntryChangeControl.
- */
-@Test
-public void testPsearchDeleteWithEC() throws Exception
-{
- setUpListenerReturnECs();
- ctx.destroySubcontext( RDN );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( RDN, listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.DELETE );
-}
-
-
-/**
- * Shows correct notifications for add(1) changes with returned
- * EntryChangeControl.
- */
-@Test
-public void testPsearchAddWithEC() throws Exception
-{
- setUpListenerReturnECs();
- ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
- waitForThreadToDie( t );
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
-}
-
-
-/**
- * Shows correct notifications for only add(1) and modify(4) registered changes with returned
- * EntryChangeControl but not deletes.
- */
-@Test
-public void testPsearchAddModifyEnabledWithEC() throws Exception
-{
- PersistentSearch ctrl = new PersistentSearchImpl();
- ctrl.setReturnECs( true );
- ctrl.setChangeTypes( ChangeType.ADD.getValue() );
- ctrl.enableNotification( ChangeType.MODIFY );
- setUpListener( true, ctrl, false );
- ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
- waitForThreadToDie( t );
-
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
- tearDownListener();
-
- setUpListener( true, ctrl, true );
- ctx.destroySubcontext( "cn=Jack Black" );
- waitForThreadToDie( t );
- assertNull( listener.result );
-
- // thread is still waiting for notifications try a modify
- ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, new BasicAttributes( "description", PERSON_DESCRIPTION,
- true ) );
- waitForThreadToDie( t );
-
- assertNotNull( listener.result );
- assertEquals( RDN, listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
-}
-
-/**
- * Shows correct notifications for add(1) changes with returned
- * EntryChangeControl and changesOnly set to false so we return
- * the first set of entries.
- *
- * This test is commented out because it exhibits some producer
- * consumer lockups (server and client being in same process)
- *
- * PLUS ALL THIS GARBAGE IS TIME DEPENDENT!!!!!
- */
-// public void testPsearchAddWithECAndFalseChangesOnly() throws Exception
-// {
-// PersistentSearchDecorator decorator = new PersistentSearchDecorator();
-// decorator.setReturnECs( true );
-// decorator.setChangesOnly( false );
-// PSearchListener listener = new PSearchListener( decorator );
-// Thread t = new Thread( listener );
-// t.start();
-//
-// Thread.sleep( 3000 );
-//
-// assertEquals( 5, listener.count );
-// ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
-//
-// long start = System.currentTimeMillis();
-// while ( t.isAlive() )
-// {
-// Thread.sleep( 100 );
-// if ( System.currentTimeMillis() - start > 3000 )
-// {
-// break;
-// }
-// }
-//
-// assertEquals( 6, listener.count );
-// assertNotNull( listener.result );
-// assertEquals( "cn=Jack Black", listener.result.getName() );
-// assertEquals( listener.result.decorator.getChangeType(), ChangeType.ADD );
-// }
-
-/**
- * Shows notifications functioning with the JNDI notification API of the SUN
- * provider.
- *
-@Test
-public void testPsearchAbandon() throws Exception
-{
- PersistentSearchDecorator decorator = new PersistentSearchDecorator();
- decorator.setReturnECs( true );
- PSearchListener listener = new PSearchListener( decorator );
- Thread t = new Thread( listener );
- t.start();
-
- while ( !listener.isReady )
- {
- Thread.sleep( 100 );
- }
- Thread.sleep( 250 );
-
- ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
-
- long start = System.currentTimeMillis();
- while ( t.isAlive() )
+
+
+ private void setUpListener() throws Exception
{
- Thread.sleep( 100 );
- if ( System.currentTimeMillis() - start > 3000 )
+ ctx = ( EventDirContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+ eventService = getLdapServer().getDirectoryService().getEventService();
+ List<RegistrationEntry> registrationEntryList = eventService.getRegistrationEntries();
+ assertTrue( registrationEntryList.isEmpty() );
+
+ listener = new PSearchListener();
+ t = new Thread( listener, "PSearchListener" );
+ t.start();
+
+ // let's wait until the listener thread started
+ while ( eventService.getRegistrationEntries().isEmpty() )
{
- break;
+ Thread.sleep( 100 );
}
+
+ // Now we wait until the listener is registered (timing dependent crap)
+ Thread.sleep( 250 );
}
-
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
- assertEquals( listener.result.decorator.getChangeType(), ChangeType.ADD );
- listener = new PSearchListener( decorator );
-
- t = new Thread( listener );
- t.start();
-
- ctx.destroySubcontext( "cn=Jack Black" );
-
- start = System.currentTimeMillis();
- while ( t.isAlive() )
+
+ @After
+ public void tearDownListener() throws Exception
{
- Thread.sleep( 100 );
- if ( System.currentTimeMillis() - start > 3000 )
+ listener.close();
+ ctx.close();
+
+ while ( !eventService.getRegistrationEntries().isEmpty() )
{
- break;
+ Thread.sleep( 100 );
}
}
-
- // there seems to be a race condition here
- // assertNull( listener.result );
- assertNotNull( listener.result );
- assertEquals( "cn=Jack Black", listener.result.getName() );
- assertEquals( ChangeType.DELETE, listener.result.decorator.getChangeType() );
- listener.result = null;
-
- // thread is still waiting for notifications try a modify
- ctx.modifyAttributes( Rdn, DirContext.REMOVE_ATTRIBUTE, new AttributesImpl( "description", PERSON_DESCRIPTION,
- true ) );
- start = System.currentTimeMillis();
- while ( t.isAlive() )
+
+
+ private void waitForThreadToDie( Thread t ) throws Exception
{
- Thread.sleep( 200 );
- if ( System.currentTimeMillis() - start > 3000 )
+ long start = System.currentTimeMillis();
+
+ while ( t.isAlive() )
{
- break;
+ Thread.sleep( 200 );
+ if ( System.currentTimeMillis() - start > 1000 )
+ {
+ break;
+ }
}
}
-
- assertNull( listener.result );
- //assertEquals( Rdn, listener.result.getName() );
- //assertEquals( listener.result.decorator.getChangeType(), ChangeType.MODIFY );
-}*/
-
-class JndiNotificationListener implements NamespaceChangeListener, ObjectChangeListener
-{
- boolean hasError = false;
- ArrayList<EventObject> list = new ArrayList<EventObject>();
- NamingExceptionEvent exceptionEvent = null;
-
-
- public void objectAdded( NamingEvent evt )
- {
- list.add( 0, evt );
+
+
+ /**
+ * Shows correct notifications for modify(4) changes.
+ */
+ @Test
+ public void testPsearchModify() throws Exception
+ {
+ setUpListener();
+ ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE,
+ new BasicAttributes( "description", PERSON_DESCRIPTION, true ) );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( RDN, listener.result.getName() );
}
-
-
- public void objectRemoved( NamingEvent evt )
- {
- list.add( 0, evt );
+
+
+ /**
+ * Shows correct notifications for moddn(8) changes.
+ */
+ @Test
+ public void testPsearchModifyDn() throws Exception
+ {
+ setUpListener();
+ ctx.rename( RDN, "cn=Jack Black" );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
}
-
-
- public void objectRenamed( NamingEvent evt )
- {
- list.add( 0, evt );
+
+
+ /**
+ * Shows correct notifications for delete(2) changes.
+ */
+ @Test
+ public void testPsearchDelete() throws Exception
+ {
+ setUpListener();
+ ctx.destroySubcontext( RDN );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( RDN, listener.result.getName() );
}
-
-
- public void namingExceptionThrown( NamingExceptionEvent evt )
- {
- hasError = true;
- exceptionEvent = evt;
- list.add( 0, evt );
+
+
+ /**
+ * Shows correct notifications for add(1) changes.
+ */
+ @Test
+ public void testPsearchAdd() throws Exception
+ {
+ setUpListener();
+ ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
}
-
-
- public void objectChanged( NamingEvent evt )
- {
- list.add( 0, evt );
+
+
+ /**
+ * Shows correct notifications for modify(4) changes with returned
+ * EntryChangeControl.
+ */
+ @Test
+ public void testPsearchModifyWithEC() throws Exception
+ {
+ setUpListenerReturnECs();
+ ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, new BasicAttributes( "description", PERSON_DESCRIPTION,
+ true ) );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( RDN, listener.result.getName() );
+ assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
}
-}
-
-class PSearchListener implements Runnable
-{
- boolean isReady = false;
- PSearchNotification result;
- final PersistentSearchDecorator persistentSearch;
- LdapContext ctx;
- NamingEnumeration<SearchResult> list;
-
-
- PSearchListener()
- {
- persistentSearch = new PersistentSearchDecorator( getLdapServer().getDirectoryService().getLdapCodecService() );
+
+
+ /**
+ * Shows correct notifications for moddn(8) changes with returned
+ * EntryChangeControl.
+ */
+ @Test
+ public void testPsearchModifyDnWithEC() throws Exception
+ {
+ setUpListenerReturnECs();
+ ctx.rename( RDN, "cn=Jack Black" );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
+ assertEquals( listener.result.control.getChangeType(), ChangeType.MODDN );
+ assertEquals( ( RDN + ",ou=system" ), listener.result.control.getPreviousDn().getName() );
}
-
-
- PSearchListener( PersistentSearch persistentSearch )
- {
- CodecControl<? extends Control> wrapped =
- getLdapServer().getDirectoryService().getLdapCodecService().newControl( persistentSearch );
- this.persistentSearch = ( PersistentSearchDecorator ) wrapped;
+
+
+ /**
+ * Shows correct notifications for delete(2) changes with returned
+ * EntryChangeControl.
+ */
+ @Test
+ public void testPsearchDeleteWithEC() throws Exception
+ {
+ setUpListenerReturnECs();
+ ctx.destroySubcontext( RDN );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( RDN, listener.result.getName() );
+ assertEquals( listener.result.control.getChangeType(), ChangeType.DELETE );
}
-
-
- void close()
- {
- if ( list != null )
+
+
+ /**
+ * Shows correct notifications for add(1) changes with returned
+ * EntryChangeControl.
+ */
+ @Test
+ public void testPsearchAddWithEC() throws Exception
+ {
+ setUpListenerReturnECs();
+ ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
+ waitForThreadToDie( t );
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
+ assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
+ }
+
+
+ /**
+ * Shows correct notifications for only add(1) and modify(4) registered changes with returned
+ * EntryChangeControl but not deletes.
+ */
+ @Test
+ public void testPsearchAddModifyEnabledWithEC() throws Exception
+ {
+ PersistentSearch ctrl = new PersistentSearchImpl();
+ ctrl.setReturnECs( true );
+ ctrl.setChangeTypes( ChangeType.ADD.getValue() );
+ ctrl.enableNotification( ChangeType.MODIFY );
+ setUpListener( true, ctrl, false );
+ ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
+ waitForThreadToDie( t );
+
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
+ assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
+ tearDownListener();
+
+ setUpListener( true, ctrl, true );
+ ctx.destroySubcontext( "cn=Jack Black" );
+ waitForThreadToDie( t );
+ assertNull( listener.result );
+
+ // thread is still waiting for notifications try a modify
+ ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, new BasicAttributes( "description", PERSON_DESCRIPTION,
+ true ) );
+ waitForThreadToDie( t );
+
+ assertNotNull( listener.result );
+ assertEquals( RDN, listener.result.getName() );
+ assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
+ }
+
+ /**
+ * Shows correct notifications for add(1) changes with returned
+ * EntryChangeControl and changesOnly set to false so we return
+ * the first set of entries.
+ *
+ * This test is commented out because it exhibits some producer
+ * consumer lockups (server and client being in same process)
+ *
+ * PLUS ALL THIS GARBAGE IS TIME DEPENDENT!!!!!
+ */
+ // public void testPsearchAddWithECAndFalseChangesOnly() throws Exception
+ // {
+ // PersistentSearchDecorator decorator = new PersistentSearchDecorator();
+ // decorator.setReturnECs( true );
+ // decorator.setChangesOnly( false );
+ // PSearchListener listener = new PSearchListener( decorator );
+ // Thread t = new Thread( listener );
+ // t.start();
+ //
+ // Thread.sleep( 3000 );
+ //
+ // assertEquals( 5, listener.count );
+ // ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
+ //
+ // long start = System.currentTimeMillis();
+ // while ( t.isAlive() )
+ // {
+ // Thread.sleep( 100 );
+ // if ( System.currentTimeMillis() - start > 3000 )
+ // {
+ // break;
+ // }
+ // }
+ //
+ // assertEquals( 6, listener.count );
+ // assertNotNull( listener.result );
+ // assertEquals( "cn=Jack Black", listener.result.getName() );
+ // assertEquals( listener.result.decorator.getChangeType(), ChangeType.ADD );
+ // }
+
+ /**
+ * Shows notifications functioning with the JNDI notification API of the SUN
+ * provider.
+ *
+ @Test
+ public void testPsearchAbandon() throws Exception
+ {
+ PersistentSearchDecorator decorator = new PersistentSearchDecorator();
+ decorator.setReturnECs( true );
+ PSearchListener listener = new PSearchListener( decorator );
+ Thread t = new Thread( listener );
+ t.start();
+
+ while ( !listener.isReady )
{
- try
- {
- list.close();
- LOG.debug( "PSearchListener: search naming enumeration closed()" );
- }
- catch ( Exception e )
+ Thread.sleep( 100 );
+ }
+ Thread.sleep( 250 );
+
+ ctx.createSubcontext( "cn=Jack Black", getPersonAttributes( "Black", "Jack Black" ) );
+
+ long start = System.currentTimeMillis();
+ while ( t.isAlive() )
+ {
+ Thread.sleep( 100 );
+ if ( System.currentTimeMillis() - start > 3000 )
{
- LOG.error( "Error closing NamingEnumeration on PSearchListener", e );
+ break;
}
}
-
- if ( ctx != null )
+
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
+ assertEquals( listener.result.decorator.getChangeType(), ChangeType.ADD );
+
+ listener = new PSearchListener( decorator );
+
+ t = new Thread( listener );
+ t.start();
+
+ ctx.destroySubcontext( "cn=Jack Black" );
+
+ start = System.currentTimeMillis();
+ while ( t.isAlive() )
{
- try
+ Thread.sleep( 100 );
+ if ( System.currentTimeMillis() - start > 3000 )
{
- ctx.close();
- LOG.debug( "PSearchListener: search context closed()" );
+ break;
}
- catch ( Exception e )
+ }
+
+ // there seems to be a race condition here
+ // assertNull( listener.result );
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
+ assertEquals( ChangeType.DELETE, listener.result.decorator.getChangeType() );
+ listener.result = null;
+
+ // thread is still waiting for notifications try a modify
+ ctx.modifyAttributes( Rdn, DirContext.REMOVE_ATTRIBUTE, new AttributesImpl( "description", PERSON_DESCRIPTION,
+ true ) );
+ start = System.currentTimeMillis();
+ while ( t.isAlive() )
+ {
+ Thread.sleep( 200 );
+ if ( System.currentTimeMillis() - start > 3000 )
{
- LOG.error( "Error closing connection on PSearchListener", e );
+ break;
}
}
+
+ assertNull( listener.result );
+ //assertEquals( Rdn, listener.result.getName() );
+ //assertEquals( listener.result.decorator.getChangeType(), ChangeType.MODIFY );
+ }*/
+
+ class JndiNotificationListener implements NamespaceChangeListener, ObjectChangeListener
+ {
+ boolean hasError = false;
+ ArrayList<EventObject> list = new ArrayList<EventObject>();
+ NamingExceptionEvent exceptionEvent = null;
+
+
+ public void objectAdded( NamingEvent evt )
+ {
+ list.add( 0, evt );
+ }
+
+
+ public void objectRemoved( NamingEvent evt )
+ {
+ list.add( 0, evt );
+ }
+
+
+ public void objectRenamed( NamingEvent evt )
+ {
+ list.add( 0, evt );
+ }
+
+
+ public void namingExceptionThrown( NamingExceptionEvent evt )
+ {
+ hasError = true;
+ exceptionEvent = evt;
+ list.add( 0, evt );
+ }
+
+
+ public void objectChanged( NamingEvent evt )
+ {
+ list.add( 0, evt );
+ }
}
-
-
- public void run()
+
+ class PSearchListener implements Runnable
{
- LOG.debug( "PSearchListener.run() called." );
- LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
- persistentSearch.setCritical( true );
- persistentSearch.setValue( persistentSearch.getValue() );
-
- Control[] ctxCtls = new Control[]
- { persistentSearch };
-
- try
+ boolean isReady = false;
+ PSearchNotification result;
+ final PersistentSearchDecorator persistentSearch;
+ LdapContext ctx;
+ NamingEnumeration<SearchResult> list;
+
+
+ PSearchListener()
{
- ctx = ( LdapContext ) getWiredContext( getLdapServer() ).lookup( BASE );
- ctx.setRequestControls( JndiUtils.toJndiControls( codec, ctxCtls ) );
- isReady = true;
- LOG.debug( "PSearchListener is ready and about to issue persistent search request." );
- list = ctx.search( "", "objectClass=*", null );
- LOG.debug( "PSearchListener search request returned." );
- EntryChange ecControl = null;
-
- while ( list.hasMore() )
+ persistentSearch = new PersistentSearchDecorator( getLdapServer().getDirectoryService().getLdapCodecService() );
+ }
+
+
+ PSearchListener( PersistentSearch persistentSearch )
+ {
+ CodecControl<? extends Control> wrapped =
+ getLdapServer().getDirectoryService().getLdapCodecService().newControl( persistentSearch );
+ this.persistentSearch = ( PersistentSearchDecorator ) wrapped;
+ }
+
+
+ void close()
+ {
+ if ( list != null )
{
- LOG.debug( "PSearchListener search request got an item." );
- javax.naming.ldap.Control[] controls;
- SearchResult sresult = list.next();
-
- if ( sresult instanceof HasControls )
+ try
{
- controls = ( ( HasControls ) sresult ).getControls();
-
- if ( controls != null )
+ list.close();
+ LOG.debug( "PSearchListener: search naming enumeration closed()" );
+ }
+ catch ( Exception e )
+ {
+ LOG.error( "Error closing NamingEnumeration on PSearchListener", e );
+ }
+ }
+
+ if ( ctx != null )
+ {
+ try
+ {
+ ctx.close();
+ LOG.debug( "PSearchListener: search context closed()" );
+ }
+ catch ( Exception e )
+ {
+ LOG.error( "Error closing connection on PSearchListener", e );
+ }
+ }
+ }
+
+
+ public void run()
+ {
+ LOG.debug( "PSearchListener.run() called." );
+ LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
+ persistentSearch.setCritical( true );
+ persistentSearch.setValue( persistentSearch.getValue() );
+
+ Control[] ctxCtls = new Control[]
+ { persistentSearch };
+
+ try
+ {
+ ctx = ( LdapContext ) getWiredContext( getLdapServer() ).lookup( BASE );
+ ctx.setRequestControls( JndiUtils.toJndiControls( codec, ctxCtls ) );
+ isReady = true;
+ LOG.debug( "PSearchListener is ready and about to issue persistent search request." );
+ list = ctx.search( "", "objectClass=*", null );
+ LOG.debug( "PSearchListener search request returned." );
+ EntryChange ecControl = null;
+
+ while ( list.hasMore() )
+ {
+ LOG.debug( "PSearchListener search request got an item." );
+ javax.naming.ldap.Control[] controls;
+ SearchResult sresult = list.next();
+
+ if ( sresult instanceof HasControls )
{
- for ( javax.naming.ldap.Control jndiControl : controls )
+ controls = ( ( HasControls ) sresult ).getControls();
+
+ if ( controls != null )
{
- if ( jndiControl.getID().equals(
- EntryChange.OID ) )
+ for ( javax.naming.ldap.Control jndiControl : controls )
{
- ecControl = ( EntryChange ) JndiUtils.fromJndiControl( codec, jndiControl );
- ( ( EntryChangeDecorator ) ecControl ).decode( jndiControl.getEncodedValue() );
+ if ( jndiControl.getID().equals(
+ EntryChange.OID ) )
+ {
+ ecControl = ( EntryChange ) JndiUtils.fromJndiControl( codec, jndiControl );
+ ( ( EntryChangeDecorator ) ecControl ).decode( jndiControl.getEncodedValue() );
+ }
}
}
}
+
+ result = new PSearchNotification( sresult, ecControl );
+ break;
}
-
- result = new PSearchNotification( sresult, ecControl );
- break;
+
+ LOG.debug( "PSearchListener broke out of while loop." );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ LOG.error( "PSearchListener encountered error", e );
+ }
+ finally
+ {
}
-
- LOG.debug( "PSearchListener broke out of while loop." );
- }
- catch ( Exception e )
- {
- e.printStackTrace();
- LOG.error( "PSearchListener encountered error", e );
- }
- finally
- {
}
}
-}
-
-class PSearchNotification extends SearchResult
-{
- private static final long serialVersionUID = 1L;
- final EntryChange control;
-
-
- public PSearchNotification( SearchResult result, EntryChange control )
- {
- super( result.getName(), result.getClassName(), result.getObject(), result.getAttributes(), result
- .isRelative() );
- this.control = control;
- }
-
-
- public String toString()
+
+ class PSearchNotification extends SearchResult
{
- StringBuffer buf = new StringBuffer();
- buf.append( "Dn: " ).append( getName() ).append( "\n" );
-
- if ( control != null )
+ private static final long serialVersionUID = 1L;
+ final EntryChange control;
+
+
+ public PSearchNotification( SearchResult result, EntryChange control )
{
- buf.append( " EntryChangeControl =\n" );
- buf.append( " changeType : " ).append( control.getChangeType() ).append( "\n" );
- buf.append( " previousDN : " ).append( control.getPreviousDn() ).append( "\n" );
- buf.append( " changeNumber : " ).append( control.getChangeNumber() ).append( "\n" );
+ super( result.getName(), result.getClassName(), result.getObject(), result.getAttributes(), result
+ .isRelative() );
+ this.control = control;
+ }
+
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "Dn: " ).append( getName() ).append( "\n" );
+
+ if ( control != null )
+ {
+ buf.append( " EntryChangeControl =\n" );
+ buf.append( " changeType : " ).append( control.getChangeType() ).append( "\n" );
+ buf.append( " previousDN : " ).append( control.getPreviousDn() ).append( "\n" );
+ buf.append( " changeNumber : " ).append( control.getChangeNumber() ).append( "\n" );
+ }
+
+ return buf.toString();
}
-
- return buf.toString();
}
}
-}
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -45,6 +45,7 @@ import javax.naming.directory.SearchResu
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.ManageReferralControl;
+import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -54,6 +55,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.ldif.LdifEntry;
import org.apache.directory.shared.ldap.model.ldif.LdifReader;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -124,6 +126,9 @@ import org.junit.runner.RunWith;
})
public class ReferralSearchIT extends AbstractLdapTestUnit
{
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
+
@Before
public void setupReferrals() throws Exception
{
@@ -255,7 +260,7 @@ public class ReferralSearchIT extends Ab
assertNotNull( results.get( "ou=users" ) );
// -------------------------------------------------------------------
- // Now we will throw exceptions when searching for referrals
+ // Now we will throw exceptions when searching for referrals
// -------------------------------------------------------------------
ctx.addToEnvironment( Context.REFERRAL, "throw" );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchMoveAndRenameIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchMoveAndRenameIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchMoveAndRenameIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchMoveAndRenameIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -34,6 +34,7 @@ import javax.naming.directory.SearchResu
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.ManageReferralControl;
+import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -43,6 +44,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.ldif.LdifEntry;
import org.apache.directory.shared.ldap.model.ldif.LdifReader;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -113,86 +115,89 @@ import org.junit.runner.RunWith;
})
public class ReferralSearchMoveAndRenameIT extends AbstractLdapTestUnit
{
-@Before
-public void setupReferrals() throws Exception
-{
- getLdapServer().getDirectoryService().getChangeLog().setEnabled( false );
-
- String ldif =
- "dn: c=europ,ou=Countries,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: referral\n" +
- "objectClass: extensibleObject\n" +
- "c: europ\n" +
- "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=france,ou=system\n\n" +
-
- "dn: c=america,ou=Countries,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: referral\n" +
- "objectClass: extensibleObject\n" +
- "c: america\n" +
- "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";
-
- LdifReader reader = new LdifReader( new StringReader( ldif ) );
-
- while ( reader.hasNext() )
- {
- LdifEntry entry = reader.next();
- getLdapServer().getDirectoryService().getAdminSession().add(
- new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
- }
-}
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
-
-/**
- * Test of an search operation with a referral after the entry
- * has been moved.
- *
- * search for "cn=alex karasulu" on "c=usa, ou=system"
- * we should get a referral URL thrown, which point to
- * "c=usa, ou=system", and ask for a subtree search
- */
-@Test
-public void testSearchBaseWithReferralThrowAfterMoveAndRename() throws Exception
-{
- DirContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
-
- SearchControls controls = new SearchControls();
- controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
- try
- {
- ctx.search( "c=america,ou=Countries,ou=system", "(cn=alex karasulu)", controls );
- fail( "Should fail here throwing a ReferralException" );
- }
- catch ( ReferralException re )
+ @Before
+ public void setupReferrals() throws Exception
{
- String referral = ( String ) re.getReferralInfo();
- assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
- }
-
- ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
- { new ManageReferralControl() } );
-
- // Now let's move the entry
- ctx.rename( "c=america,ou=Countries,ou=system", "c=us,ou=system" );
-
- controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
- ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
- {} );
-
- try
- {
- NamingEnumeration<SearchResult> results = ctx.search( "c=us,ou=system", "(cn=alex karasulu)", controls );
-
- results.next();
- fail( "Should fail here throwing a ReferralException" );
+ getLdapServer().getDirectoryService().getChangeLog().setEnabled( false );
+
+ String ldif =
+ "dn: c=europ,ou=Countries,ou=system\n" +
+ "objectClass: top\n" +
+ "objectClass: referral\n" +
+ "objectClass: extensibleObject\n" +
+ "c: europ\n" +
+ "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=france,ou=system\n\n" +
+
+ "dn: c=america,ou=Countries,ou=system\n" +
+ "objectClass: top\n" +
+ "objectClass: referral\n" +
+ "objectClass: extensibleObject\n" +
+ "c: america\n" +
+ "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";
+
+ LdifReader reader = new LdifReader( new StringReader( ldif ) );
+
+ while ( reader.hasNext() )
+ {
+ LdifEntry entry = reader.next();
+ getLdapServer().getDirectoryService().getAdminSession().add(
+ new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
+ }
}
- catch ( ReferralException re )
- {
- String referral = ( String ) re.getReferralInfo();
- assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+
+
+ /**
+ * Test of an search operation with a referral after the entry
+ * has been moved.
+ *
+ * search for "cn=alex karasulu" on "c=usa, ou=system"
+ * we should get a referral URL thrown, which point to
+ * "c=usa, ou=system", and ask for a subtree search
+ */
+ @Test
+ public void testSearchBaseWithReferralThrowAfterMoveAndRename() throws Exception
+ {
+ DirContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
+
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+ try
+ {
+ ctx.search( "c=america,ou=Countries,ou=system", "(cn=alex karasulu)", controls );
+ fail( "Should fail here throwing a ReferralException" );
+ }
+ catch ( ReferralException re )
+ {
+ String referral = ( String ) re.getReferralInfo();
+ assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+ }
+
+ ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
+ { new ManageReferralControl() } );
+
+ // Now let's move the entry
+ ctx.rename( "c=america,ou=Countries,ou=system", "c=us,ou=system" );
+
+ controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+ ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
+ {} );
+
+ try
+ {
+ NamingEnumeration<SearchResult> results = ctx.search( "c=us,ou=system", "(cn=alex karasulu)", controls );
+
+ results.next();
+ fail( "Should fail here throwing a ReferralException" );
+ }
+ catch ( ReferralException re )
+ {
+ String referral = ( String ) re.getReferralInfo();
+ assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+ }
}
-}
}
\ No newline at end of file
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchNoRevertIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchNoRevertIT.java?rev=1334639&r1=1334638&r2=1334639&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchNoRevertIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchNoRevertIT.java Sun May 6 14:25:18 2012
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.operations.search;
@@ -32,6 +32,7 @@ import javax.naming.directory.SearchCont
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.ManageReferralControl;
+import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -46,6 +47,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.ldif.LdifReader;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -136,91 +138,93 @@ import org.junit.runner.RunWith;
})
public class ReferralSearchNoRevertIT extends AbstractLdapTestUnit
{
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
-@Before
-public void setupReferrals() throws Exception
-{
- getLdapServer().getDirectoryService().getChangeLog().setEnabled( false );
-
- String ldif =
- "dn: c=europ,ou=Countries,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: referral\n" +
- "objectClass: extensibleObject\n" +
- "c: europ\n" +
- "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=france,ou=system\n\n" +
-
- "dn: c=america,ou=Countries,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: referral\n" +
- "objectClass: extensibleObject\n" +
- "c: america\n" +
- "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";
-
- LdifReader reader = new LdifReader( new StringReader( ldif ) );
- while ( reader.hasNext() )
- {
- LdifEntry entry = reader.next();
- getLdapServer().getDirectoryService().getAdminSession().add(
- new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
- }
-}
-
-
-/**
- * Test of an search operation with a referral after the entry
- * has been moved.
- *
- * search for "cn=alex karasulu" on "c=america, ou=system"
- * we should get a referral URL thrown, which point to
- * "c=usa, ou=system", and ask for a subtree search
- */
-@Test
-public void testSearchBaseWithReferralThrowAfterMove() throws Exception
-{
- DirContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
-
- SearchControls controls = new SearchControls();
- controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
- try
- {
- ctx.search( "c=america,ou=Countries,ou=system", "(cn=alex karasulu)", controls );
- fail( "Should fail here throwing a ReferralException" );
- }
- catch ( ReferralException re )
+ @Before
+ public void setupReferrals() throws Exception
{
- String referral = ( String ) re.getReferralInfo();
- assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+ getLdapServer().getDirectoryService().getChangeLog().setEnabled( false );
+
+ String ldif =
+ "dn: c=europ,ou=Countries,ou=system\n" +
+ "objectClass: top\n" +
+ "objectClass: referral\n" +
+ "objectClass: extensibleObject\n" +
+ "c: europ\n" +
+ "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=france,ou=system\n\n" +
+
+ "dn: c=america,ou=Countries,ou=system\n" +
+ "objectClass: top\n" +
+ "objectClass: referral\n" +
+ "objectClass: extensibleObject\n" +
+ "c: america\n" +
+ "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";
+
+ LdifReader reader = new LdifReader( new StringReader( ldif ) );
+ while ( reader.hasNext() )
+ {
+ LdifEntry entry = reader.next();
+ getLdapServer().getDirectoryService().getAdminSession().add(
+ new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
+ }
}
-
- ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
- { new ManageReferralControl() } );
-
- // Now let's move the entry
- ctx.rename( "c=america,ou=Countries,ou=system", "c=america,ou=system" );
-
- controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
- ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
- {} );
-
- try
- {
- ctx.search( "c=america,ou=system", "(cn=alex karasulu)", controls );
- fail( "Should fail here throwing a ReferralException" );
+
+
+ /**
+ * Test of an search operation with a referral after the entry
+ * has been moved.
+ *
+ * search for "cn=alex karasulu" on "c=america, ou=system"
+ * we should get a referral URL thrown, which point to
+ * "c=usa, ou=system", and ask for a subtree search
+ */
+ @Test
+ public void testSearchBaseWithReferralThrowAfterMove() throws Exception
+ {
+ DirContext ctx = getWiredContextThrowOnRefferal( getLdapServer() );
+
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+ try
+ {
+ ctx.search( "c=america,ou=Countries,ou=system", "(cn=alex karasulu)", controls );
+ fail( "Should fail here throwing a ReferralException" );
+ }
+ catch ( ReferralException re )
+ {
+ String referral = ( String ) re.getReferralInfo();
+ assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+ }
+
+ ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
+ { new ManageReferralControl() } );
+
+ // Now let's move the entry
+ ctx.rename( "c=america,ou=Countries,ou=system", "c=america,ou=system" );
+
+ controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+ ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
+ {} );
+
+ try
+ {
+ ctx.search( "c=america,ou=system", "(cn=alex karasulu)", controls );
+ fail( "Should fail here throwing a ReferralException" );
+ }
+ catch ( ReferralException re )
+ {
+ String referral = ( String ) re.getReferralInfo();
+ assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+ }
}
- catch ( ReferralException re )
+
+
+ @After
+ public void after()
{
- String referral = ( String ) re.getReferralInfo();
- assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
+ getLdapServer().getDirectoryService().getChangeLog().setEnabled( true );
}
-}
-
-
-@After
-public void after()
-{
- getLdapServer().getDirectoryService().getChangeLog().setEnabled( true );
-}
}
\ No newline at end of file