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 2009/05/04 19:36:55 UTC

svn commit: r771374 - /directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java

Author: elecharny
Date: Mon May  4 17:36:55 2009
New Revision: 771374

URL: http://svn.apache.org/viewvc?rev=771374&view=rev
Log:
Fixed a failing test on windows by checking that a /tmp directory exist on the machine before launching the test

Modified:
    directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java

Modified: directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java?rev=771374&r1=771373&r2=771374&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java (original)
+++ directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java Mon May  4 17:36:55 2009
@@ -171,30 +171,38 @@
      */
     @Test
     public void testSpringServerJdbmPartition() throws Exception {
-        ClassLoader classLoader = this.getClass().getClassLoader();
-        URL configURL = classLoader.getResource( "serverJdbmPartition.xml" );
-
-        File configF = new File( configURL.toURI() );
-        ApplicationContext factory = new FileSystemXmlApplicationContext( configF.toURI().toURL().toString() );
-        ApacheDS apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
-        File workingDirFile = new File( configF.getParentFile(), "work" );
-        apacheDS.getDirectoryService().setWorkingDirectory( workingDirFile );
-        
-        // Now, launch the server, and check that the ObjectClass index has been created in OS' tmp directory
-        apacheDS.startup();
-        
-        File tmpOCdb = new File( getTmpDir(), "objectClass.db" );
-        assertTrue( tmpOCdb.exists() );
-
-        File tmpOClg = new File( getTmpDir(), "objectClass.lg" );
-        assertTrue( tmpOClg.exists() );
-        
-        // Shutdown and cleanup
-        apacheDS.shutdown();
-        
-        // Clean the /tmp/objectClass.* files
-        tmpOCdb.delete();
-        tmpOClg.delete();
+    	// NOTE : This test will only work on systems which have a /tmp temp dir
+    	if ( "/tmp".equals( getTmpDir() ) )
+    	{
+	        ClassLoader classLoader = this.getClass().getClassLoader();
+	        URL configURL = classLoader.getResource( "serverJdbmPartition.xml" );
+	
+	        File configF = new File( configURL.toURI() );
+	        ApplicationContext factory = new FileSystemXmlApplicationContext( configF.toURI().toURL().toString() );
+	        ApacheDS apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
+	        File workingDirFile = new File( configF.getParentFile(), "work" );
+	        apacheDS.getDirectoryService().setWorkingDirectory( workingDirFile );
+	        
+	        // Now, launch the server, and check that the ObjectClass index has been created in OS' tmp directory
+	        apacheDS.startup();
+	        
+	        File tmpOCdb = new File( getTmpDir(), "objectClass.db" );
+	        assertTrue( tmpOCdb.exists() );
+	
+	        File tmpOClg = new File( getTmpDir(), "objectClass.lg" );
+	        assertTrue( tmpOClg.exists() );
+	        
+	        // Shutdown and cleanup
+	        apacheDS.shutdown();
+	        
+	        // Clean the /tmp/objectClass.* files
+	        tmpOCdb.delete();
+	        tmpOClg.delete();
+    	}
+    	else
+    	{
+    		assertTrue( true );
+    	}
     }
     
     /**