You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/11/23 21:20:36 UTC
svn commit: r1038318 -
/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Author: seelmann
Date: Tue Nov 23 20:20:36 2010
New Revision: 1038318
URL: http://svn.apache.org/viewvc?rev=1038318&view=rev
Log:
Use context class loader instead of annotation class to load LDIF file. Required to use unit test framework in OSGi environment
Modified:
directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1038318&r1=1038317&r2=1038318&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java Tue Nov 23 20:20:36 2010
@@ -253,13 +253,13 @@ public class DSAnnotationProcessor
* @param ldifFiles the array of LDIF file names (only )
* @throws Exception
*/
- public static void injectLdifFiles( Class<?> clazz, DirectoryService service, String[] ldifFiles ) throws Exception
+ public static void injectLdifFiles( DirectoryService service, String[] ldifFiles ) throws Exception
{
if ( ( ldifFiles != null ) && ( ldifFiles.length > 0 ) )
{
for ( String ldifFile : ldifFiles )
{
- InputStream is = clazz.getClassLoader().getResourceAsStream( ldifFile );
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( ldifFile );
if ( is == null )
{
throw new FileNotFoundException( "LDIF file '" + ldifFile + "' not found." );
@@ -318,7 +318,7 @@ public class DSAnnotationProcessor
if ( applyLdifFiles != null )
{
LOG.debug( "Applying {} to {}", applyLdifFiles.value(), desc.getDisplayName() );
- injectLdifFiles( desc.getClass(), service, applyLdifFiles.value() );
+ injectLdifFiles( service, applyLdifFiles.value() );
}
ApplyLdifs applyLdifs = desc.getAnnotation( ApplyLdifs.class );