Author: akarasulu
Date: Mon Dec 3 18:57:29 2007
New Revision: 600772
URL: http://svn.apache.org/viewvc?rev=600772&view=rev
Log:
changes to integration framework ...
o added another test
o began putting in some logging for tracing problems
o fixed and infinate loop bug where we cycled through some states over and over
o found serious issue with server partition removal which seems to leave
behind some residue causing a misconfigured server after shutdown and restart
Will not fix now just filed JIRA and will get back to this later but for now
this test should be kept last in the suite: DIRSERVER-1106
o making logger show more errors in your face
Added:
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/event/
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java
- copied, changed from r600740, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/event/EventServiceITest.java
Removed:
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/event/
Modified:
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
directory/apacheds/branches/bigbang/core-integ/src/test/resources/log4j.properties
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java
Mon Dec 3 18:57:29 2007
@@ -81,6 +81,8 @@
}
catch ( Exception e )
{
+ LOG.error( "Encountered exception while trying to cleanup after test class:
"
+ + this.getDescription().getDisplayName(), e );
notifier.fireTestFailure( new Failure( getDescription(), e ) );
}
}
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
Mon Dec 3 18:57:29 2007
@@ -23,14 +23,10 @@
import org.apache.directory.server.core.integ.SetupMode;
import org.junit.internal.runners.TestClass;
import org.junit.internal.runners.TestMethod;
-import org.junit.internal.runners.MethodRoadie;
import org.junit.runner.notification.RunNotifier;
-import org.junit.runner.Description;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.lang.reflect.InvocationTargetException;
-
/**
* The state of a test service when it has not yet been created.
@@ -42,6 +38,11 @@
{
private static final Logger LOG = LoggerFactory.getLogger( NonExistentState.class );
private final TestServiceContext context;
+ private static final String DESTROY_ERR = "Cannot destroy when service is in NonExistant
state";
+ private static final String CLEANUP_ERROR = "Cannot cleanup when service is in NonExistant
state";
+ private static final String STARTUP_ERR = "Cannot startup when service is in NonExistant
state";
+ private static final String SHUTDOWN_ERR = "Cannot shutdown service in NonExistant state.";
+ private static final String REVERT_ERROR = "Cannot revert when service is in NonExistant
state";
public NonExistentState( TestServiceContext context )
@@ -52,6 +53,7 @@
public void create( DirectoryServiceFactory factory )
{
+ LOG.debug( "calling create()" );
context.setService( factory.newInstance() );
context.setState( context.getStoppedDirtyState() );
}
@@ -59,25 +61,29 @@
public void destroy()
{
- throw new IllegalStateException( "Cannot destroy when service is in NonExistant state"
);
+ LOG.error( DESTROY_ERR );
+ throw new IllegalStateException( DESTROY_ERR );
}
public void cleanup()
{
- throw new IllegalStateException( "Cannot cleanup when service is in NonExistant state"
);
+ LOG.error( CLEANUP_ERROR );
+ throw new IllegalStateException( CLEANUP_ERROR );
}
public void startup()
{
- throw new IllegalStateException( "Cannot startup when service is in NonExistant state"
);
+ LOG.error( STARTUP_ERR );
+ throw new IllegalStateException( STARTUP_ERR );
}
public void shutdown()
{
- throw new IllegalStateException( "Cannot shutdown service in NonExistant state."
);
+ LOG.error( SHUTDOWN_ERR );
+ throw new IllegalStateException( SHUTDOWN_ERR );
}
@@ -95,14 +101,12 @@
* PRISTINE and ROLLBACK modes we do the same but cleanup() before a
* restart.
*
- *
- * @param testClass
- * @param testMethod
- * @param notifier
- * @param settings
+ * @see TestServiceState#test(TestClass, TestMethod, RunNotifier, InheritableSettings)
*/
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
+
if ( settings.getMode() == SetupMode.NOSERVICE || testMethod.isIgnored() )
{
// no state change here
@@ -119,6 +123,7 @@
}
catch ( Exception e )
{
+ LOG.error( "Failed to create and start new server instance: " + e );
notifier.testAborted( settings.getDescription(), e );
return;
}
@@ -134,6 +139,7 @@
}
catch ( Exception e )
{
+ LOG.error( "Failed to create, cleanup and start new server instance: " +
e );
notifier.testAborted( settings.getDescription(), e );
return;
}
@@ -146,6 +152,7 @@
public void revert()
{
- throw new IllegalStateException( "Cannot revert when service is in NonExistant state"
);
+ LOG.error( REVERT_ERROR );
+ throw new IllegalStateException( REVERT_ERROR );
}
}
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
Mon Dec 3 18:57:29 2007
@@ -21,7 +21,6 @@
import org.apache.directory.server.core.integ.DirectoryServiceFactory;
import org.apache.directory.server.core.integ.InheritableSettings;
import org.apache.directory.server.core.integ.SetupMode;
-import org.apache.directory.shared.ldap.NotImplementedException;
import org.junit.internal.runners.TestClass;
import org.junit.internal.runners.TestMethod;
import org.junit.runner.notification.RunNotifier;
@@ -42,6 +41,10 @@
{
private static final Logger LOG = LoggerFactory.getLogger( StartedDirtyState.class );
private final TestServiceContext context;
+ private static final String CREATE_ERROR = "Cannot create new instance while service
is running.";
+ private static final String DESTROY_ERROR = "Cannot destroy started service.";
+ private static final String CLEANUP_ERR = "Cannot cleanup started service.";
+ private static final String STARTUP_ERR = "Cannot startup started service.";
public StartedDirtyState( TestServiceContext context )
@@ -52,30 +55,35 @@
public void create( DirectoryServiceFactory factory )
{
- throw new IllegalStateException( "Cannot create new instance while service is running.");
+ LOG.error( CREATE_ERROR );
+ throw new IllegalStateException( CREATE_ERROR );
}
public void destroy()
{
- throw new IllegalStateException( "Cannot destroy started service." );
+ LOG.error( DESTROY_ERROR );
+ throw new IllegalStateException( DESTROY_ERROR );
}
public void cleanup()
{
- throw new IllegalStateException( "Cannot cleanup started service." );
+ LOG.error( CLEANUP_ERR );
+ throw new IllegalStateException( CLEANUP_ERR );
}
public void startup()
{
- throw new IllegalStateException( "Cannot startup started service." );
+ LOG.error( STARTUP_ERR );
+ throw new IllegalStateException( STARTUP_ERR );
}
public void shutdown() throws NamingException
{
+ LOG.debug( "calling shutdown() " );
context.getService().shutdown();
context.setState( context.getStoppedDirtyState() );
}
@@ -83,6 +91,7 @@
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
if ( settings.getMode() == SetupMode.NOSERVICE || testMethod.isIgnored() )
{
// no state change here
@@ -96,18 +105,11 @@
{
context.getState().shutdown();
context.getState().cleanup();
-
- // @todo check if the factory changed here
- if ( true ) // change this to check if factory changed since the last run
- {
- context.getState().destroy();
- context.getState().create( settings.getFactory() );
- }
-
- context.getState().startup();
}
catch ( Exception e )
{
+ LOG.error( "Failed to reach pristine restart for test: "
+ + settings.getDescription().getDisplayName(), e );
notifier.testAborted( settings.getDescription(), e );
return;
}
@@ -127,6 +129,7 @@
}
catch ( Exception e )
{
+ LOG.error( "Failed to restart for test: " + settings.getDescription().getDisplayName(),
e );
notifier.testAborted( settings.getDescription(), e );
return;
}
@@ -178,6 +181,7 @@
}
catch ( Exception e )
{
+ LOG.error( "Failed to revert for test: " + settings.getDescription().getDisplayName(),
e );
notifier.testAborted( settings.getDescription(), e );
return;
}
@@ -196,6 +200,7 @@
public void revert() throws NamingException
{
+ LOG.debug( "calling revert()" );
context.getService().revert();
context.setState( context.getStartedRevertedState() );
}
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
Mon Dec 3 18:57:29 2007
@@ -22,7 +22,6 @@
import org.apache.directory.server.core.integ.DirectoryServiceFactory;
import org.apache.directory.server.core.integ.InheritableSettings;
import org.apache.directory.server.core.integ.SetupMode;
-import org.apache.directory.shared.ldap.NotImplementedException;
import org.junit.internal.runners.TestClass;
import org.junit.internal.runners.TestMethod;
import org.junit.runner.notification.RunNotifier;
@@ -77,6 +76,7 @@
public void shutdown() throws NamingException
{
+ LOG.debug( "calling shutdown()" );
context.getService().shutdown();
context.setState( context.getStoppedPristineState() );
}
@@ -84,6 +84,8 @@
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
+
if ( settings.getMode() == SetupMode.NOSERVICE || testMethod.isIgnored() )
{
// no state change here
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
Mon Dec 3 18:57:29 2007
@@ -80,6 +80,7 @@
public void shutdown() throws NamingException
{
+ LOG.debug( "calling shutdown()" );
context.getService().shutdown();
context.setState( context.getStoppedDirtyState() );
}
@@ -87,6 +88,7 @@
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
if ( settings.getMode() == SetupMode.NOSERVICE || testMethod.isIgnored() )
{
// no state change here
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
Mon Dec 3 18:57:29 2007
@@ -61,6 +61,7 @@
public void destroy()
{
+ LOG.debug( "calling destroy()" );
context.setService( null );
context.setState( context.getNonExistentState() );
System.gc();
@@ -69,6 +70,7 @@
public void cleanup() throws IOException
{
+ LOG.debug( "calling cleanup()" );
doDelete( context.getService().getWorkingDirectory() );
context.setState( context.getStoppedPristineState() );
}
@@ -76,6 +78,7 @@
public void startup() throws NamingException
{
+ LOG.debug( "calling startup" );
context.getService().startup();
context.setState( context.getStartedDirtyState() );
}
@@ -97,6 +100,8 @@
*/
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
+
if ( settings.getMode() == SetupMode.NOSERVICE || testMethod.isIgnored() )
{
// no state change here
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
Mon Dec 3 18:57:29 2007
@@ -61,6 +61,7 @@
public void destroy()
{
+ LOG.debug( "calling destroy()" );
context.setService( null );
context.setState( context.getNonExistentState() );
System.gc();
@@ -75,12 +76,14 @@
*/
public void cleanup() throws IOException
{
+ LOG.debug( "calling cleanup()" );
doDelete( context.getService().getWorkingDirectory() );
}
public void startup() throws NamingException
{
+ LOG.debug( "calling startup()" );
context.getService().startup();
context.setState( context.getStartedPristineState() );
}
@@ -94,6 +97,7 @@
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
if ( settings.getMode() == SetupMode.NOSERVICE || testMethod.isIgnored() )
{
// no state change here
Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
Mon Dec 3 18:57:29 2007
@@ -27,6 +27,8 @@
import org.junit.internal.runners.TestMethod;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.naming.NamingException;
import java.io.IOException;
@@ -44,6 +46,7 @@
*/
public class TestServiceContext
{
+ private static final Logger LOG = LoggerFactory.getLogger( TestServiceContext.class );
private static final ThreadLocal<TestServiceContext> CONTEXTS = new ThreadLocal<TestServiceContext>();
private final TestServiceState nonExistentState = new NonExistentState( this );
@@ -164,6 +167,7 @@
public static void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier,
InheritableSettings settings )
{
+ LOG.debug( "calling test(): {}", settings.getDescription().getDisplayName() );
get().getState().test( testClass, testMethod, notifier, settings );
}
@@ -193,11 +197,13 @@
}
catch ( InvocationTargetException e )
{
+ LOG.error( "Failed to invoke test method: " + description.getDisplayName(), e.getCause()
);
notifier.testAborted( description, e.getCause() );
return;
}
catch ( Exception e )
{
+ LOG.error( "Failed to invoke test method: " + description.getDisplayName(), e
);
notifier.testAborted( description, e );
return;
}
Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
Mon Dec 3 18:57:29 2007
@@ -21,6 +21,7 @@
import org.apache.directory.server.core.authn.SimpleAuthenticationIT;
import org.apache.directory.server.core.collective.CollectiveAttributeServiceIT;
import org.apache.directory.server.core.configuration.PartitionConfigurationIT;
+import org.apache.directory.server.core.event.EventServiceIT;
import org.apache.directory.server.core.integ.CiSuite;
import org.apache.directory.server.core.integ.ServiceScope;
import org.apache.directory.server.core.integ.SetupMode;
@@ -40,7 +41,8 @@
@Suite.SuiteClasses ( {
SimpleAuthenticationIT.class,
CollectiveAttributeServiceIT.class,
- PartitionConfigurationIT.class
+ EventServiceIT.class,
+ PartitionConfigurationIT.class // Leaves the server in a bad state (partition removal
is incomplete)
} )
@Scope ( ServiceScope.TESTSUITE )
@Mode ( SetupMode.ROLLBACK )
Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java
(from r600740, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/event/EventServiceITest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java&p1=directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/event/EventServiceITest.java&r1=600740&r2=600772&rev=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/event/EventServiceITest.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java
Mon Dec 3 18:57:29 2007
@@ -20,23 +20,25 @@
package org.apache.directory.server.core.event;
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.CiRunner;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
+import org.apache.directory.server.core.integ.SetupMode;
+import org.apache.directory.server.core.integ.annotations.Mode;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
-import javax.naming.event.EventDirContext;
-import javax.naming.event.NamespaceChangeListener;
-import javax.naming.event.NamingEvent;
-import javax.naming.event.NamingExceptionEvent;
-import javax.naming.event.ObjectChangeListener;
-
-import java.util.List;
+import javax.naming.event.*;
import java.util.ArrayList;
import java.util.EventObject;
+import java.util.List;
/**
@@ -45,16 +47,23 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class EventServiceITest extends AbstractAdminTestCase
+@RunWith ( CiRunner.class )
+public class EventServiceIT
{
+ public static DirectoryService service;
+
+
/**
* Test to make sure NamingListener's are no longer registered
* after they are removed via the EventContex.removeNamingListener method.
+ *
+ * @throws NamingException on failures
*/
+ @Test
public void testRemoveNamingListener() throws NamingException
{
TestListener listener = new TestListener();
- EventDirContext ctx = ( EventDirContext ) super.sysRoot.lookup( "" );
+ EventDirContext ctx = ( EventDirContext ) getSystemContext( service ).lookup( ""
);
ctx.addNamingListener( "", SearchControls.SUBTREE_SCOPE, listener );
Attributes testEntry = new AttributesImpl( "ou", "testentry", true );
Attribute objectClass = new AttributeImpl( "objectClass", "top" );
@@ -87,11 +96,14 @@
/**
* Test to make sure NamingListener's are no longer registered
* after the context used for registration is closed.
+ *
+ * @throws NamingException on failures
*/
+ @Test
public void testContextClose() throws NamingException
{
TestListener listener = new TestListener();
- EventDirContext ctx = ( EventDirContext ) super.sysRoot.lookup( "" );
+ EventDirContext ctx = ( EventDirContext ) getSystemContext( service ).lookup( ""
);
ctx.addNamingListener( "", SearchControls.SUBTREE_SCOPE, listener );
Attributes testEntry = new AttributesImpl( "ou", "testentry", true );
Attribute objectClass = new AttributeImpl( "objectClass", "top" );
@@ -105,7 +117,7 @@
assertEquals( ctx, rec.event.getSource() );
ctx.close();
- ctx = ( EventDirContext ) super.sysRoot.lookup( "" );
+ ctx = ( EventDirContext ) getSystemContext( service ).lookup( "" );
ctx.destroySubcontext( "ou=testentry" );
assertEquals( 1, listener.getEventRecords().size() );
@@ -119,6 +131,7 @@
assertEquals( "objectAdded", rec.method );
}
+
public class TestListener implements ObjectChangeListener, NamespaceChangeListener
{
List<EventRecord> events = new ArrayList<EventRecord>();
Modified: directory/apacheds/branches/bigbang/core-integ/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/resources/log4j.properties?rev=600772&r1=600771&r2=600772&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/resources/log4j.properties (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/resources/log4j.properties Mon
Dec 3 18:57:29 2007
@@ -19,4 +19,4 @@
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-
+log4j.logger.org.apache.directory.server.core.integ=ERROR
|