You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Ole Ersoy <ol...@gmail.com> on 2007/06/14 02:23:14 UTC

[ApacheDS Embedded] Reusing a Connection Environment

Hey Guys,

This is pretty minor, but I thought I'd mention it.  While working on the testing archetype, I tried reusing a createEnvironment() method when creating the environment for the Embedded LdapContext.  I get a NamingException when doing this.  It says it can't parse "ou=system".  If I do a "fresh" Hashtable for the environment, with the exact same key-value pairs the test is green.  I thought this was very odd, so I tried it over and over, in all sorts of creative ways.  The same thing works fine for non-embedded connections.  It's almost like a security manager is preventing the class from using a environment created in a different class.

Cheers,
- Ole


Re: [ApacheDS Embedded] Reusing a Connection Environment

Posted by Ole Ersoy <ol...@gmail.com>.
Emmanuel Lecharny wrote:
> Ole Ersoy a écrit :
> 
SNIP

> What about cloning the existing env, before reusing it ?

I still need to try that.  I tried creating a new Hashtable, passing it to the initialization routine, and then overriding Context.PROVIDER_URL, and that fails.
> 
>> If I do a "fresh" Hashtable for the environment, with the exact same 
>> key-value pairs the test is green.  I thought this was very odd, so I 
>> tried it over and over, in all sorts of creative ways.  The same thing 
>> works fine for non-embedded connections.  It's almost like a security 
>> manager is preventing the class from using a environment created in a 
>> different class.
> 
> Can you provide a test case for this problem ?

Indeed.  The whole archetype I'm about to submit is the TestCase.  All you have to do is run it, then instead of using the "New" Hashtable for the embedded connection, do this:

env = createEnvironment(env);

This will initialize the env.  Then try using it.  Now if I can just get subclipse installed.  Eclipse 3.2 is barking.  I'm going to have to go command line I think.  Just have to do it.  Deep breath.

Cheers,
- Ole



Re: [ApacheDS Embedded] Reusing a Connection Environment

Posted by Emmanuel Lecharny <el...@apache.org>.
Ole Ersoy a écrit :

> Hey Guys,
>
> This is pretty minor, but I thought I'd mention it.  While working on 
> the testing archetype, I tried reusing a createEnvironment() method 
> when creating the environment for the Embedded LdapContext.  I get a 
> NamingException when doing this.  It says it can't parse "ou=system".  

What about cloning the existing env, before reusing it ?

> If I do a "fresh" Hashtable for the environment, with the exact same 
> key-value pairs the test is green.  I thought this was very odd, so I 
> tried it over and over, in all sorts of creative ways.  The same thing 
> works fine for non-embedded connections.  It's almost like a security 
> manager is preventing the class from using a environment created in a 
> different class.

Can you provide a test case for this problem ?

Thanks,
Emmanuel