You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/10/30 19:53:33 UTC
svn commit: r1029133 -
/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
Author: kayyagari
Date: Sat Oct 30 17:53:33 2010
New Revision: 1029133
URL: http://svn.apache.org/viewvc?rev=1029133&view=rev
Log:
o some more cleanup related to removing workdir
Modified:
directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=1029133&r1=1029132&r2=1029133&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Sat Oct 30 17:53:33 2010
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
import java.io.File;
+import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.InstanceLayout;
@@ -38,6 +39,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.schema.registries.Schema;
import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
import org.apache.directory.shared.ldap.util.LdapExceptionUtils;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -60,7 +62,8 @@ public class PartitionSchemaLoaderTest
{
// setup working directory
directoryService = new DefaultDirectoryService();
- File workingDirectory = new File( System.getProperty( "workingDirectory", System.getProperty( "user.dir" ) ) );
+ String tmpDirPath = System.getProperty( "workingDirectory", System.getProperty( "java.io.tmpdir" ) );
+ File workingDirectory = new File( tmpDirPath + "/server-work-" + PartitionSchemaLoaderTest.class.getSimpleName() );
instanceLayout = new InstanceLayout( workingDirectory );
directoryService.setInstanceLayout( instanceLayout );
@@ -75,13 +78,6 @@ public class PartitionSchemaLoaderTest
// Load the bootstrap schemas to start up the schema partition
// --------------------------------------------------------------------
- if ( workingDirectory == null )
- {
- String path = PartitionSchemaLoaderTest.class.getResource( "" ).getPath();
- int targetPos = path.indexOf( "target" );
- workingDirectory = new File( path.substring( 0, targetPos + 6 ) );
- }
-
File schemaRepository = new File( workingDirectory, "schema" );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( workingDirectory );
extractor.extractOrCopy( true );
@@ -99,6 +95,13 @@ public class PartitionSchemaLoaderTest
}
+ @AfterClass
+ public static void cleanup() throws Exception
+ {
+ FileUtils.deleteDirectory( instanceLayout.getInstanceDirectory() );
+ }
+
+
@Test
public void testGetSchemas() throws Exception
{