// Add a single test entry
// -------------------------------------------------------------------
Attributes attributes = new LockableAttributesImpl();
LdifParserImpl parser = new LdifParserImpl();
try
{
parser.parse( attributes, LDIF );
}
catch ( NamingException e )
{
throw new NestableRuntimeException( e );
}
testEntries.add( attributes );
// -------------------------------------------------------------------
// Add more from an optional LDIF file if they exist
// -------------------------------------------------------------------
InputStream in = null;
if ( loadClass == null && ldifPath != null )
{
File ldifFile = new File( ldifPath );
if ( ldifFile.exists() )
{
in = new FileInputStream( ldifPath );
}
else
{
in = getClass().getResourceAsStream( ldifPath );
}
throw new FileNotFoundException( ldifPath );
}
else if ( loadClass != null && ldifPath != null )
{
in = loadClass.getResourceAsStream( ldifPath );
}
if ( in != null )
{
LdifIterator list = new LdifIterator( in );
while ( list.hasNext() )
{
String ldif = ( String ) list.next();
attributes = new LockableAttributesImpl();
parser.parse( attributes, ldif );
testEntries.add( attributes );
}
}