You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Christoph Czurda <ha...@gmail.com> on 2012/02/01 06:16:37 UTC

connection.exists(Dn) is false although entry exists

Hello!

I came accross a strange issue in a unit test. (server ApacheDS 2.0)

Testing connection.exists(Dn dn) returns false.
When I test the String overload with the same dn I get true.

The code can probably explain better than words:

Dn dn;
//dn is initialized with an existing Dn.

//this test passes:
assertThat(connection.exists(dn.getName()), is(true));

//this fails. AssertionError: expected true, got false
assertThat(connection.exists(dn), is(true));

How can that be? exists(Dn) works fine in other tests.

Maybe I should mention that I get lots of these messages:

2012-02-01 05:56:00,730 [NioProcessor-2] WARN
org.apache.directory.shared.asn1.ber.Asn1Decoder -
ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
but there are still bytes in the buffer.

But they occur with almost every message sent to the server. Btw, can I
get rid of them somehow?

Kind regards,
Christoph

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Thanks Christoph,

I will try to have a look at it later today or tomorrow morning.

Regards,
Pierre-Arnaud

On 1 févr. 2012, at 12:26, Christoph Czurda wrote:

> Hi Pierre-Arnaud,
> 
> I attached the ldif file. Btw, I used the LdapNetworkConnection as
> proposed in another thread. While it enabled my custom schema, it still
> gives the same result for this particular unit test.
> 
> If you have the time, feel free to comment on my schema. It is my first
> schema and I appreciate any feedback.
> 
> Kind regards,
> Christoph
> 
> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>> Thanks Christoph,
>> 
>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>> 
>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>> 
>> Regards,
>> Pierre-Arnaud
>> 
>> 
>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>> 
>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>> Hi Christoph,
>>>> 
>>>> Could we have a look at the full DN you're using?
>>> Sure, here it is:
>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>> 
>>>> Thanks,
>>>> Pierre-Arnaud
>>>> 
>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>> 
>>>>> Hello!
>>>>> 
>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>> 
>>>>> Testing connection.exists(Dn dn) returns false.
>>>>> When I test the String overload with the same dn I get true.
>>>>> 
>>>>> The code can probably explain better than words:
>>>>> 
>>>>> Dn dn;
>>>>> //dn is initialized with an existing Dn.
>>>>> 
>>>>> //this test passes:
>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>> 
>>>>> //this fails. AssertionError: expected true, got false
>>>>> assertThat(connection.exists(dn), is(true));
>>>>> 
>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>> 
>>>>> Maybe I should mention that I get lots of these messages:
>>>>> 
>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>> but there are still bytes in the buffer.
>>>>> 
>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>> get rid of them somehow?
>>>>> 
>>>>> Kind regards,
>>>>> Christoph
>>>> 
>> 
> <openengsbSchema.ldif>


Re: connection.exists(Dn) is false although entry exists

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/2/12 12:36 AM, Christoph Czurda wrote:
> So I thought if this works for a Dn, it might as well work for a Rdn. 
> Maybe the Rdn constructor should throw an InvalidDnException if it is 
> passed a String containing more than one '='. 

Definitively.

Can you create a JIRA for this issue ? Not that it's a problem that is 
likely to hit many people, but the fact that you have lost hours trying 
to understand what was the problem prove that the RDN constructor is not 
user-friendly, and this should be corrected.

Thanks !

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.

On 02/02/2012 12:18 AM, Alex Karasulu wrote:
> On Thu, Feb 2, 2012 at 1:14 AM, Christoph Czurda
> <ha...@gmail.com>wrote:
> 
>> On 02/01/2012 11:58 PM, Alex Karasulu wrote:
>>> On Wed, Feb 1, 2012 at 10:19 PM, Christoph Czurda
>>> <ha...@gmail.com>wrote:
>>>
>>>> Hi Pierre-Arnaud,
>>>>
>>>> The mistake was on my side. I used Rdn rdn = new Rdn("cn=a,ou=b"); and
>>>> passed this to a Dn constructor. I misinterpreted the description of
>>>> class Rdn where it says that any String with a '=' is treated as a full
>>>> Rdn. When I changed it, it worked as expected.
>>>>
>>>>
>>> Just curious can you show me the offending code? I really did not
>>> understand your description.
>>>
>>> I ask this because it might show which area of our API is weak in terms
>> of
>>> being intuitive. If the user understands the domain a good API shows
>>> exactly how it should be used by the object model and methods.
>>>
>>>
>> It was like this:
>> Dn parent = new Dn("ou=system");
>> Dn somewhereBelow = new Dn(new Rdn("cn=a,cn=b"),parent); //the problem
>> was the rdn
>>
>> I thought that in this constructor everything before the parent is
>> simply prepended.
> 
> 
> So if understand correctly you thought Rdn is not a single name component
> but one that can have 1 or more name components like for example a relative
> path in the fs namespace?
> 
Well, I was aware that a Rdn only relates to the lowest Ava of a Dn. I
mixed up the following:

>From api documentation of constructor public Dn(String... upRdns):

If the String contains a '=' symbol, the the constructor will assume
that the String arg contains afull Rdn, otherwise, it will consider that
the following arg is the value.

So I thought if this works for a Dn, it might as well work for a Rdn.
Maybe the Rdn constructor should throw an InvalidDnException if it is
passed a String containing more than one '='.
> 
>> The interesting thing is that dn.getName() did what I
>> actually intended, ie it returns "cn=a,cn=b,ou=system".
>>
>>
> Odd.
> 
> Thanks for the feedback.
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Alex Karasulu <ak...@apache.org>.
On Thu, Feb 2, 2012 at 1:14 AM, Christoph Czurda
<ha...@gmail.com>wrote:

> On 02/01/2012 11:58 PM, Alex Karasulu wrote:
> > On Wed, Feb 1, 2012 at 10:19 PM, Christoph Czurda
> > <ha...@gmail.com>wrote:
> >
> >> Hi Pierre-Arnaud,
> >>
> >> The mistake was on my side. I used Rdn rdn = new Rdn("cn=a,ou=b"); and
> >> passed this to a Dn constructor. I misinterpreted the description of
> >> class Rdn where it says that any String with a '=' is treated as a full
> >> Rdn. When I changed it, it worked as expected.
> >>
> >>
> > Just curious can you show me the offending code? I really did not
> > understand your description.
> >
> > I ask this because it might show which area of our API is weak in terms
> of
> > being intuitive. If the user understands the domain a good API shows
> > exactly how it should be used by the object model and methods.
> >
> >
> It was like this:
> Dn parent = new Dn("ou=system");
> Dn somewhereBelow = new Dn(new Rdn("cn=a,cn=b"),parent); //the problem
> was the rdn
>
> I thought that in this constructor everything before the parent is
> simply prepended.


So if understand correctly you thought Rdn is not a single name component
but one that can have 1 or more name components like for example a relative
path in the fs namespace?


> The interesting thing is that dn.getName() did what I
> actually intended, ie it returns "cn=a,cn=b,ou=system".
>
>
Odd.

Thanks for the feedback.

-- 
Best Regards,
-- Alex

Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.
On 02/01/2012 11:58 PM, Alex Karasulu wrote:
> On Wed, Feb 1, 2012 at 10:19 PM, Christoph Czurda
> <ha...@gmail.com>wrote:
> 
>> Hi Pierre-Arnaud,
>>
>> The mistake was on my side. I used Rdn rdn = new Rdn("cn=a,ou=b"); and
>> passed this to a Dn constructor. I misinterpreted the description of
>> class Rdn where it says that any String with a '=' is treated as a full
>> Rdn. When I changed it, it worked as expected.
>>
>>
> Just curious can you show me the offending code? I really did not
> understand your description.
> 
> I ask this because it might show which area of our API is weak in terms of
> being intuitive. If the user understands the domain a good API shows
> exactly how it should be used by the object model and methods.
> 
> 
It was like this:
Dn parent = new Dn("ou=system");
Dn somewhereBelow = new Dn(new Rdn("cn=a,cn=b"),parent); //the problem
was the rdn

I thought that in this constructor everything before the parent is
simply prepended. The interesting thing is that dn.getName() did what I
actually intended, ie it returns "cn=a,cn=b,ou=system".

Kind regards,
Christoph

Re: connection.exists(Dn) is false although entry exists

Posted by Alex Karasulu <ak...@apache.org>.
On Wed, Feb 1, 2012 at 10:19 PM, Christoph Czurda
<ha...@gmail.com>wrote:

> Hi Pierre-Arnaud,
>
> The mistake was on my side. I used Rdn rdn = new Rdn("cn=a,ou=b"); and
> passed this to a Dn constructor. I misinterpreted the description of
> class Rdn where it says that any String with a '=' is treated as a full
> Rdn. When I changed it, it worked as expected.
>
>
Just curious can you show me the offending code? I really did not
understand your description.

I ask this because it might show which area of our API is weak in terms of
being intuitive. If the user understands the domain a good API shows
exactly how it should be used by the object model and methods.


-- 
Best Regards,
-- Alex

Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.
Hi Pierre-Arnaud,

The mistake was on my side. I used Rdn rdn = new Rdn("cn=a,ou=b"); and
passed this to a Dn constructor. I misinterpreted the description of
class Rdn where it says that any String with a '=' is treated as a full
Rdn. When I changed it, it worked as expected.

I'm sorry for wasting your time.

Kind regards,
Christoph

On 02/01/2012 02:14 PM, Christoph Czurda wrote:
> Yes, maybe it's just a version issue. Anyway, thank you for your effort.
> I will fetch the latest versions later and then report back.
> 
> Kind regards,
> Christoph
> 
> On 02/01/2012 01:55 PM, Pierre-Arnaud Marcelot wrote:
>> Thanks.
>>
>> I deleted my branch and imported yours from the LDIF.
>>
>> Everything works as expected.
>>
>> Here's my testing Main class:
>>> import java.io.IOException;
>>>
>>> import org.apache.directory.ldap.client.api.LdapConnectionConfig;
>>> import org.apache.directory.ldap.client.api.LdapNetworkConnection;
>>> import org.apache.directory.shared.ldap.model.exception.LdapException;
>>> import org.apache.directory.shared.ldap.model.name.Dn;
>>>
>>>
>>> public class Main
>>> {
>>>     public static void main( String[] args ) throws LdapException, IOException
>>>     {
>>>         String dnString = "cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org";
>>>         Dn dn = new Dn( dnString );
>>>
>>>         LdapConnectionConfig config = new LdapConnectionConfig();
>>>         config.setLdapHost( "localhost" );
>>>         config.setLdapPort( 10389 );
>>>         config.setName( "uid=admin,ou=system" );
>>>         config.setCredentials( "secret" );
>>>
>>>         LdapNetworkConnection connection = new LdapNetworkConnection( config );
>>>
>>>         connection.bind();
>>>
>>>         System.out.println( connection.exists( dnString ) );
>>>         System.out.println( connection.exists( dn ) );
>>>         System.out.println( connection.exists( dn.getName() ) );
>>>         
>>>         connection.close();
>>>     }
>>> }
>>
>> That's really weird you're getting an error.
>>
>> In my testing environment I'm using both trunk versions of API/Shared and ApacheDS.
>> Maybe there was a bug in previous versions and it got fixed in between…
>>
>> Regards,
>> Pierre-Arnaud
>>
>> On 1 févr. 2012, at 13:42, Christoph Czurda wrote:
>>
>>> Here it is.
>>> Thank you,
>>> Christoph
>>>
>>> On 02/01/2012 01:29 PM, Pierre-Arnaud Marcelot wrote:
>>>> Thanks.
>>>>
>>>> It's funny, but I really can't replicate the issue.
>>>>
>>>> When I use these three ways to access the information, they all succeed and print "true":
>>>>> System.out.println( connection.exists( dnString ) );
>>>>> System.out.println( connection.exists( dn ) );
>>>>> System.out.println( connection.exists( dn.getName() ) );
>>>>
>>>>
>>>> Could you also attach the LDIF of the 'dc=openengsb,dc=org' branch please?
>>>> Maybe I'm missing something here...
>>>>
>>>> Thanks,
>>>> Pierre-Arnaud
>>>>
>>>>
>>>> On 1 févr. 2012, at 13:22, Christoph Czurda wrote:
>>>>
>>>>>
>>>>>
>>>>> On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
>>>>>> Christoph,
>>>>>>
>>>>>> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
>>>>> Yes, that's correct.
>>>>>>
>>>>>> Regards,
>>>>>> Pierre-Arnaud
>>>>>>
>>>>>>
>>>>>> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
>>>>>>
>>>>>>> Hi Pierre-Arnaud,
>>>>>>>
>>>>>>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>>>>>>> proposed in another thread. While it enabled my custom schema, it still
>>>>>>> gives the same result for this particular unit test.
>>>>>>>
>>>>>>> If you have the time, feel free to comment on my schema. It is my first
>>>>>>> schema and I appreciate any feedback.
>>>>>>>
>>>>>>> Kind regards,
>>>>>>> Christoph
>>>>>>>
>>>>>>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>>> Thanks Christoph,
>>>>>>>>
>>>>>>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>>>>>>
>>>>>>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>>>>>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Pierre-Arnaud
>>>>>>>>
>>>>>>>>
>>>>>>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>>>>>>
>>>>>>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>>>>> Hi Christoph,
>>>>>>>>>>
>>>>>>>>>> Could we have a look at the full DN you're using?
>>>>>>>>> Sure, here it is:
>>>>>>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Pierre-Arnaud
>>>>>>>>>>
>>>>>>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello!
>>>>>>>>>>>
>>>>>>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>>>>>>
>>>>>>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>>>>>>> When I test the String overload with the same dn I get true.
>>>>>>>>>>>
>>>>>>>>>>> The code can probably explain better than words:
>>>>>>>>>>>
>>>>>>>>>>> Dn dn;
>>>>>>>>>>> //dn is initialized with an existing Dn.
>>>>>>>>>>>
>>>>>>>>>>> //this test passes:
>>>>>>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>>>>>>
>>>>>>>>>>> //this fails. AssertionError: expected true, got false
>>>>>>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>>>>>>
>>>>>>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>>>>>>
>>>>>>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>>>>>>
>>>>>>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>>>>>>> but there are still bytes in the buffer.
>>>>>>>>>>>
>>>>>>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>>>>>>> get rid of them somehow?
>>>>>>>>>>>
>>>>>>>>>>> Kind regards,
>>>>>>>>>>> Christoph
>>>>>>>>>>
>>>>>>>>
>>>>>>> <openengsbSchema.ldif>
>>>>>>
>>>>
>>> <openengsb-branch.ldif><openengsb-branch-with-operational-attributes.ldif>
>>
>>

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@gmail.com>.
Hi Christoph,

No worries.

Glad you found what the issue was.

Regards,
Pierre-Arnaud

Le 1 févr. 2012 à 21:19, Christoph Czurda <ha...@gmail.com> a écrit :

> Hi Pierre-Arnaud,
>
> The mistake was on my side. I used Rdn rdn = new Rdn("cn=a,ou=b"); and
> passed this to a Dn constructor. I misinterpreted the description of
> class Rdn where it says that any String with a '=' is treated as a full
> Rdn. When I changed it, it worked as expected.
>
> I'm sorry for wasting your time.
>
> Kind regards,
> Christoph
>
> On 02/01/2012 02:14 PM, Christoph Czurda wrote:
>> Yes, maybe it's just a version issue. Anyway, thank you for your effort.
>> I will fetch the latest versions later and then report back.
>>
>> Kind regards,
>> Christoph
>>
>> On 02/01/2012 01:55 PM, Pierre-Arnaud Marcelot wrote:
>>> Thanks.
>>>
>>> I deleted my branch and imported yours from the LDIF.
>>>
>>> Everything works as expected.
>>>
>>> Here's my testing Main class:
>>>> import java.io.IOException;
>>>>
>>>> import org.apache.directory.ldap.client.api.LdapConnectionConfig;
>>>> import org.apache.directory.ldap.client.api.LdapNetworkConnection;
>>>> import org.apache.directory.shared.ldap.model.exception.LdapException;
>>>> import org.apache.directory.shared.ldap.model.name.Dn;
>>>>
>>>>
>>>> public class Main
>>>> {
>>>>    public static void main( String[] args ) throws LdapException, IOException
>>>>    {
>>>>        String dnString = "cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org";
>>>>        Dn dn = new Dn( dnString );
>>>>
>>>>        LdapConnectionConfig config = new LdapConnectionConfig();
>>>>        config.setLdapHost( "localhost" );
>>>>        config.setLdapPort( 10389 );
>>>>        config.setName( "uid­min,ou=system" );
>>>>        config.setCredentials( "secret" );
>>>>
>>>>        LdapNetworkConnection connection = new LdapNetworkConnection( config );
>>>>
>>>>        connection.bind();
>>>>
>>>>        System.out.println( connection.exists( dnString ) );
>>>>        System.out.println( connection.exists( dn ) );
>>>>        System.out.println( connection.exists( dn.getName() ) );
>>>>
>>>>        connection.close();
>>>>    }
>>>> }
>>>
>>> That's really weird you're getting an error.
>>>
>>> In my testing environment I'm using both trunk versions of API/Shared and ApacheDS.
>>> Maybe there was a bug in previous versions and it got fixed in between…
>>>
>>> Regards,
>>> Pierre-Arnaud
>>>
>>> On 1 févr. 2012, at 13:42, Christoph Czurda wrote:
>>>
>>>> Here it is.
>>>> Thank you,
>>>> Christoph
>>>>
>>>> On 02/01/2012 01:29 PM, Pierre-Arnaud Marcelot wrote:
>>>>> Thanks.
>>>>>
>>>>> It's funny, but I really can't replicate the issue.
>>>>>
>>>>> When I use these three ways to access the information, they all succeed and print "true":
>>>>>> System.out.println( connection.exists( dnString ) );
>>>>>> System.out.println( connection.exists( dn ) );
>>>>>> System.out.println( connection.exists( dn.getName() ) );
>>>>>
>>>>>
>>>>> Could you also attach the LDIF of the 'dc=openengsb,dc=org' branch please?
>>>>> Maybe I'm missing something here...
>>>>>
>>>>> Thanks,
>>>>> Pierre-Arnaud
>>>>>
>>>>>
>>>>> On 1 févr. 2012, at 13:22, Christoph Czurda wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
>>>>>>> Christoph,
>>>>>>>
>>>>>>> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
>>>>>> Yes, that's correct.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Pierre-Arnaud
>>>>>>>
>>>>>>>
>>>>>>> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
>>>>>>>
>>>>>>>> Hi Pierre-Arnaud,
>>>>>>>>
>>>>>>>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>>>>>>>> proposed in another thread. While it enabled my custom schema, it still
>>>>>>>> gives the same result for this particular unit test.
>>>>>>>>
>>>>>>>> If you have the time, feel free to comment on my schema. It is my first
>>>>>>>> schema and I appreciate any feedback.
>>>>>>>>
>>>>>>>> Kind regards,
>>>>>>>> Christoph
>>>>>>>>
>>>>>>>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>>>> Thanks Christoph,
>>>>>>>>>
>>>>>>>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>>>>>>>
>>>>>>>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>>>>>>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Pierre-Arnaud
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>>>>>>>
>>>>>>>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>>>>>> Hi Christoph,
>>>>>>>>>>>
>>>>>>>>>>> Could we have a look at the full DN you're using?
>>>>>>>>>> Sure, here it is:
>>>>>>>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Pierre-Arnaud
>>>>>>>>>>>
>>>>>>>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hello!
>>>>>>>>>>>>
>>>>>>>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>>>>>>>
>>>>>>>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>>>>>>>> When I test the String overload with the same dn I get true.
>>>>>>>>>>>>
>>>>>>>>>>>> The code can probably explain better than words:
>>>>>>>>>>>>
>>>>>>>>>>>> Dn dn;
>>>>>>>>>>>> //dn is initialized with an existing Dn.
>>>>>>>>>>>>
>>>>>>>>>>>> //this test passes:
>>>>>>>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>>>>>>>
>>>>>>>>>>>> //this fails. AssertionError: expected true, got false
>>>>>>>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>>>>>>>
>>>>>>>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>>>>>>>
>>>>>>>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>>>>>>>
>>>>>>>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>>>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>>>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>>>>>>>> but there are still bytes in the buffer.
>>>>>>>>>>>>
>>>>>>>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>>>>>>>> get rid of them somehow?
>>>>>>>>>>>>
>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>> Christoph
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>> <openengsbSchema.ldif>
>>>>>>>
>>>>>
>>>> <openengsb-branch.ldif><openengsb-branch-with-operational-attributes.ldif>
>>>
>>>

Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.
Yes, maybe it's just a version issue. Anyway, thank you for your effort.
I will fetch the latest versions later and then report back.

Kind regards,
Christoph

On 02/01/2012 01:55 PM, Pierre-Arnaud Marcelot wrote:
> Thanks.
> 
> I deleted my branch and imported yours from the LDIF.
> 
> Everything works as expected.
> 
> Here's my testing Main class:
>> import java.io.IOException;
>>
>> import org.apache.directory.ldap.client.api.LdapConnectionConfig;
>> import org.apache.directory.ldap.client.api.LdapNetworkConnection;
>> import org.apache.directory.shared.ldap.model.exception.LdapException;
>> import org.apache.directory.shared.ldap.model.name.Dn;
>>
>>
>> public class Main
>> {
>>     public static void main( String[] args ) throws LdapException, IOException
>>     {
>>         String dnString = "cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org";
>>         Dn dn = new Dn( dnString );
>>
>>         LdapConnectionConfig config = new LdapConnectionConfig();
>>         config.setLdapHost( "localhost" );
>>         config.setLdapPort( 10389 );
>>         config.setName( "uid=admin,ou=system" );
>>         config.setCredentials( "secret" );
>>
>>         LdapNetworkConnection connection = new LdapNetworkConnection( config );
>>
>>         connection.bind();
>>
>>         System.out.println( connection.exists( dnString ) );
>>         System.out.println( connection.exists( dn ) );
>>         System.out.println( connection.exists( dn.getName() ) );
>>         
>>         connection.close();
>>     }
>> }
> 
> That's really weird you're getting an error.
> 
> In my testing environment I'm using both trunk versions of API/Shared and ApacheDS.
> Maybe there was a bug in previous versions and it got fixed in between…
> 
> Regards,
> Pierre-Arnaud
> 
> On 1 févr. 2012, at 13:42, Christoph Czurda wrote:
> 
>> Here it is.
>> Thank you,
>> Christoph
>>
>> On 02/01/2012 01:29 PM, Pierre-Arnaud Marcelot wrote:
>>> Thanks.
>>>
>>> It's funny, but I really can't replicate the issue.
>>>
>>> When I use these three ways to access the information, they all succeed and print "true":
>>>> System.out.println( connection.exists( dnString ) );
>>>> System.out.println( connection.exists( dn ) );
>>>> System.out.println( connection.exists( dn.getName() ) );
>>>
>>>
>>> Could you also attach the LDIF of the 'dc=openengsb,dc=org' branch please?
>>> Maybe I'm missing something here...
>>>
>>> Thanks,
>>> Pierre-Arnaud
>>>
>>>
>>> On 1 févr. 2012, at 13:22, Christoph Czurda wrote:
>>>
>>>>
>>>>
>>>> On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
>>>>> Christoph,
>>>>>
>>>>> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
>>>> Yes, that's correct.
>>>>>
>>>>> Regards,
>>>>> Pierre-Arnaud
>>>>>
>>>>>
>>>>> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
>>>>>
>>>>>> Hi Pierre-Arnaud,
>>>>>>
>>>>>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>>>>>> proposed in another thread. While it enabled my custom schema, it still
>>>>>> gives the same result for this particular unit test.
>>>>>>
>>>>>> If you have the time, feel free to comment on my schema. It is my first
>>>>>> schema and I appreciate any feedback.
>>>>>>
>>>>>> Kind regards,
>>>>>> Christoph
>>>>>>
>>>>>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>> Thanks Christoph,
>>>>>>>
>>>>>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>>>>>
>>>>>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>>>>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Pierre-Arnaud
>>>>>>>
>>>>>>>
>>>>>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>>>>>
>>>>>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>>>> Hi Christoph,
>>>>>>>>>
>>>>>>>>> Could we have a look at the full DN you're using?
>>>>>>>> Sure, here it is:
>>>>>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Pierre-Arnaud
>>>>>>>>>
>>>>>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>>>>>
>>>>>>>>>> Hello!
>>>>>>>>>>
>>>>>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>>>>>
>>>>>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>>>>>> When I test the String overload with the same dn I get true.
>>>>>>>>>>
>>>>>>>>>> The code can probably explain better than words:
>>>>>>>>>>
>>>>>>>>>> Dn dn;
>>>>>>>>>> //dn is initialized with an existing Dn.
>>>>>>>>>>
>>>>>>>>>> //this test passes:
>>>>>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>>>>>
>>>>>>>>>> //this fails. AssertionError: expected true, got false
>>>>>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>>>>>
>>>>>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>>>>>
>>>>>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>>>>>
>>>>>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>>>>>> but there are still bytes in the buffer.
>>>>>>>>>>
>>>>>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>>>>>> get rid of them somehow?
>>>>>>>>>>
>>>>>>>>>> Kind regards,
>>>>>>>>>> Christoph
>>>>>>>>>
>>>>>>>
>>>>>> <openengsbSchema.ldif>
>>>>>
>>>
>> <openengsb-branch.ldif><openengsb-branch-with-operational-attributes.ldif>
> 
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Thanks.

I deleted my branch and imported yours from the LDIF.

Everything works as expected.

Here's my testing Main class:
> import java.io.IOException;
> 
> import org.apache.directory.ldap.client.api.LdapConnectionConfig;
> import org.apache.directory.ldap.client.api.LdapNetworkConnection;
> import org.apache.directory.shared.ldap.model.exception.LdapException;
> import org.apache.directory.shared.ldap.model.name.Dn;
> 
> 
> public class Main
> {
>     public static void main( String[] args ) throws LdapException, IOException
>     {
>         String dnString = "cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org";
>         Dn dn = new Dn( dnString );
> 
>         LdapConnectionConfig config = new LdapConnectionConfig();
>         config.setLdapHost( "localhost" );
>         config.setLdapPort( 10389 );
>         config.setName( "uid=admin,ou=system" );
>         config.setCredentials( "secret" );
> 
>         LdapNetworkConnection connection = new LdapNetworkConnection( config );
> 
>         connection.bind();
> 
>         System.out.println( connection.exists( dnString ) );
>         System.out.println( connection.exists( dn ) );
>         System.out.println( connection.exists( dn.getName() ) );
>         
>         connection.close();
>     }
> }

That's really weird you're getting an error.

In my testing environment I'm using both trunk versions of API/Shared and ApacheDS.
Maybe there was a bug in previous versions and it got fixed in between…

Regards,
Pierre-Arnaud

On 1 févr. 2012, at 13:42, Christoph Czurda wrote:

> Here it is.
> Thank you,
> Christoph
> 
> On 02/01/2012 01:29 PM, Pierre-Arnaud Marcelot wrote:
>> Thanks.
>> 
>> It's funny, but I really can't replicate the issue.
>> 
>> When I use these three ways to access the information, they all succeed and print "true":
>>> System.out.println( connection.exists( dnString ) );
>>> System.out.println( connection.exists( dn ) );
>>> System.out.println( connection.exists( dn.getName() ) );
>> 
>> 
>> Could you also attach the LDIF of the 'dc=openengsb,dc=org' branch please?
>> Maybe I'm missing something here...
>> 
>> Thanks,
>> Pierre-Arnaud
>> 
>> 
>> On 1 févr. 2012, at 13:22, Christoph Czurda wrote:
>> 
>>> 
>>> 
>>> On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
>>>> Christoph,
>>>> 
>>>> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
>>> Yes, that's correct.
>>>> 
>>>> Regards,
>>>> Pierre-Arnaud
>>>> 
>>>> 
>>>> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
>>>> 
>>>>> Hi Pierre-Arnaud,
>>>>> 
>>>>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>>>>> proposed in another thread. While it enabled my custom schema, it still
>>>>> gives the same result for this particular unit test.
>>>>> 
>>>>> If you have the time, feel free to comment on my schema. It is my first
>>>>> schema and I appreciate any feedback.
>>>>> 
>>>>> Kind regards,
>>>>> Christoph
>>>>> 
>>>>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>> Thanks Christoph,
>>>>>> 
>>>>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>>>> 
>>>>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>>>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>>>> 
>>>>>> Regards,
>>>>>> Pierre-Arnaud
>>>>>> 
>>>>>> 
>>>>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>>>> 
>>>>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>>> Hi Christoph,
>>>>>>>> 
>>>>>>>> Could we have a look at the full DN you're using?
>>>>>>> Sure, here it is:
>>>>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> Pierre-Arnaud
>>>>>>>> 
>>>>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>>>> 
>>>>>>>>> Hello!
>>>>>>>>> 
>>>>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>>>> 
>>>>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>>>>> When I test the String overload with the same dn I get true.
>>>>>>>>> 
>>>>>>>>> The code can probably explain better than words:
>>>>>>>>> 
>>>>>>>>> Dn dn;
>>>>>>>>> //dn is initialized with an existing Dn.
>>>>>>>>> 
>>>>>>>>> //this test passes:
>>>>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>>>> 
>>>>>>>>> //this fails. AssertionError: expected true, got false
>>>>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>>>> 
>>>>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>>>> 
>>>>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>>>> 
>>>>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>>>>> but there are still bytes in the buffer.
>>>>>>>>> 
>>>>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>>>>> get rid of them somehow?
>>>>>>>>> 
>>>>>>>>> Kind regards,
>>>>>>>>> Christoph
>>>>>>>> 
>>>>>> 
>>>>> <openengsbSchema.ldif>
>>>> 
>> 
> <openengsb-branch.ldif><openengsb-branch-with-operational-attributes.ldif>


Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.
Here it is.
Thank you,
Christoph

On 02/01/2012 01:29 PM, Pierre-Arnaud Marcelot wrote:
> Thanks.
> 
> It's funny, but I really can't replicate the issue.
> 
> When I use these three ways to access the information, they all succeed and print "true":
>> System.out.println( connection.exists( dnString ) );
>> System.out.println( connection.exists( dn ) );
>> System.out.println( connection.exists( dn.getName() ) );
> 
> 
> Could you also attach the LDIF of the 'dc=openengsb,dc=org' branch please?
> Maybe I'm missing something here...
> 
> Thanks,
> Pierre-Arnaud
> 
> 
> On 1 févr. 2012, at 13:22, Christoph Czurda wrote:
> 
>>
>>
>> On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
>>> Christoph,
>>>
>>> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
>> Yes, that's correct.
>>>
>>> Regards,
>>> Pierre-Arnaud
>>>
>>>
>>> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
>>>
>>>> Hi Pierre-Arnaud,
>>>>
>>>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>>>> proposed in another thread. While it enabled my custom schema, it still
>>>> gives the same result for this particular unit test.
>>>>
>>>> If you have the time, feel free to comment on my schema. It is my first
>>>> schema and I appreciate any feedback.
>>>>
>>>> Kind regards,
>>>> Christoph
>>>>
>>>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>> Thanks Christoph,
>>>>>
>>>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>>>
>>>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>>>
>>>>> Regards,
>>>>> Pierre-Arnaud
>>>>>
>>>>>
>>>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>>>
>>>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>>> Hi Christoph,
>>>>>>>
>>>>>>> Could we have a look at the full DN you're using?
>>>>>> Sure, here it is:
>>>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Pierre-Arnaud
>>>>>>>
>>>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>>>
>>>>>>>> Hello!
>>>>>>>>
>>>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>>>
>>>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>>>> When I test the String overload with the same dn I get true.
>>>>>>>>
>>>>>>>> The code can probably explain better than words:
>>>>>>>>
>>>>>>>> Dn dn;
>>>>>>>> //dn is initialized with an existing Dn.
>>>>>>>>
>>>>>>>> //this test passes:
>>>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>>>
>>>>>>>> //this fails. AssertionError: expected true, got false
>>>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>>>
>>>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>>>
>>>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>>>
>>>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>>>> but there are still bytes in the buffer.
>>>>>>>>
>>>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>>>> get rid of them somehow?
>>>>>>>>
>>>>>>>> Kind regards,
>>>>>>>> Christoph
>>>>>>>
>>>>>
>>>> <openengsbSchema.ldif>
>>>
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Thanks.

It's funny, but I really can't replicate the issue.

When I use these three ways to access the information, they all succeed and print "true":
> System.out.println( connection.exists( dnString ) );
> System.out.println( connection.exists( dn ) );
> System.out.println( connection.exists( dn.getName() ) );


Could you also attach the LDIF of the 'dc=openengsb,dc=org' branch please?
Maybe I'm missing something here...

Thanks,
Pierre-Arnaud


On 1 févr. 2012, at 13:22, Christoph Czurda wrote:

> 
> 
> On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
>> Christoph,
>> 
>> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
> Yes, that's correct.
>> 
>> Regards,
>> Pierre-Arnaud
>> 
>> 
>> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
>> 
>>> Hi Pierre-Arnaud,
>>> 
>>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>>> proposed in another thread. While it enabled my custom schema, it still
>>> gives the same result for this particular unit test.
>>> 
>>> If you have the time, feel free to comment on my schema. It is my first
>>> schema and I appreciate any feedback.
>>> 
>>> Kind regards,
>>> Christoph
>>> 
>>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>>> Thanks Christoph,
>>>> 
>>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>> 
>>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>> 
>>>> Regards,
>>>> Pierre-Arnaud
>>>> 
>>>> 
>>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>> 
>>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>>> Hi Christoph,
>>>>>> 
>>>>>> Could we have a look at the full DN you're using?
>>>>> Sure, here it is:
>>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>> 
>>>>>> Thanks,
>>>>>> Pierre-Arnaud
>>>>>> 
>>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>> 
>>>>>>> Hello!
>>>>>>> 
>>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>> 
>>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>>> When I test the String overload with the same dn I get true.
>>>>>>> 
>>>>>>> The code can probably explain better than words:
>>>>>>> 
>>>>>>> Dn dn;
>>>>>>> //dn is initialized with an existing Dn.
>>>>>>> 
>>>>>>> //this test passes:
>>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>> 
>>>>>>> //this fails. AssertionError: expected true, got false
>>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>> 
>>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>> 
>>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>> 
>>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>>> but there are still bytes in the buffer.
>>>>>>> 
>>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>>> get rid of them somehow?
>>>>>>> 
>>>>>>> Kind regards,
>>>>>>> Christoph
>>>>>> 
>>>> 
>>> <openengsbSchema.ldif>
>> 


Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.

On 02/01/2012 01:13 PM, Pierre-Arnaud Marcelot wrote:
> Christoph,
> 
> I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?
Yes, that's correct.
> 
> Regards,
> Pierre-Arnaud
> 
> 
> On 1 févr. 2012, at 12:26, Christoph Czurda wrote:
> 
>> Hi Pierre-Arnaud,
>>
>> I attached the ldif file. Btw, I used the LdapNetworkConnection as
>> proposed in another thread. While it enabled my custom schema, it still
>> gives the same result for this particular unit test.
>>
>> If you have the time, feel free to comment on my schema. It is my first
>> schema and I appreciate any feedback.
>>
>> Kind regards,
>> Christoph
>>
>> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>>> Thanks Christoph,
>>>
>>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>>>
>>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>>>
>>> Regards,
>>> Pierre-Arnaud
>>>
>>>
>>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>>>
>>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>>> Hi Christoph,
>>>>>
>>>>> Could we have a look at the full DN you're using?
>>>> Sure, here it is:
>>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>>>
>>>>> Thanks,
>>>>> Pierre-Arnaud
>>>>>
>>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>>>
>>>>>> Hello!
>>>>>>
>>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>>>
>>>>>> Testing connection.exists(Dn dn) returns false.
>>>>>> When I test the String overload with the same dn I get true.
>>>>>>
>>>>>> The code can probably explain better than words:
>>>>>>
>>>>>> Dn dn;
>>>>>> //dn is initialized with an existing Dn.
>>>>>>
>>>>>> //this test passes:
>>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>>>
>>>>>> //this fails. AssertionError: expected true, got false
>>>>>> assertThat(connection.exists(dn), is(true));
>>>>>>
>>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>>>
>>>>>> Maybe I should mention that I get lots of these messages:
>>>>>>
>>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>>> but there are still bytes in the buffer.
>>>>>>
>>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>>> get rid of them somehow?
>>>>>>
>>>>>> Kind regards,
>>>>>> Christoph
>>>>>
>>>
>> <openengsbSchema.ldif>
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Christoph,

I guess the 'cn=testAttribute' entry is an instance of the 'openengsb-namedObject' Object Class, right?

Regards,
Pierre-Arnaud


On 1 févr. 2012, at 12:26, Christoph Czurda wrote:

> Hi Pierre-Arnaud,
> 
> I attached the ldif file. Btw, I used the LdapNetworkConnection as
> proposed in another thread. While it enabled my custom schema, it still
> gives the same result for this particular unit test.
> 
> If you have the time, feel free to comment on my schema. It is my first
> schema and I appreciate any feedback.
> 
> Kind regards,
> Christoph
> 
> On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
>> Thanks Christoph,
>> 
>> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
>> 
>> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
>> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
>> 
>> Regards,
>> Pierre-Arnaud
>> 
>> 
>> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
>> 
>>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>>> Hi Christoph,
>>>> 
>>>> Could we have a look at the full DN you're using?
>>> Sure, here it is:
>>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>> 
>>>> Thanks,
>>>> Pierre-Arnaud
>>>> 
>>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>> 
>>>>> Hello!
>>>>> 
>>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>> 
>>>>> Testing connection.exists(Dn dn) returns false.
>>>>> When I test the String overload with the same dn I get true.
>>>>> 
>>>>> The code can probably explain better than words:
>>>>> 
>>>>> Dn dn;
>>>>> //dn is initialized with an existing Dn.
>>>>> 
>>>>> //this test passes:
>>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>> 
>>>>> //this fails. AssertionError: expected true, got false
>>>>> assertThat(connection.exists(dn), is(true));
>>>>> 
>>>>> How can that be? exists(Dn) works fine in other tests.
>>>>> 
>>>>> Maybe I should mention that I get lots of these messages:
>>>>> 
>>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>>> but there are still bytes in the buffer.
>>>>> 
>>>>> But they occur with almost every message sent to the server. Btw, can I
>>>>> get rid of them somehow?
>>>>> 
>>>>> Kind regards,
>>>>> Christoph
>>>> 
>> 
> <openengsbSchema.ldif>


Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.
Hi Pierre-Arnaud,

I attached the ldif file. Btw, I used the LdapNetworkConnection as
proposed in another thread. While it enabled my custom schema, it still
gives the same result for this particular unit test.

If you have the time, feel free to comment on my schema. It is my first
schema and I appreciate any feedback.

Kind regards,
Christoph

On 02/01/2012 11:34 AM, Pierre-Arnaud Marcelot wrote:
> Thanks Christoph,
> 
> I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.
> 
> As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
> Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?
> 
> Regards,
> Pierre-Arnaud
> 
> 
> On 1 févr. 2012, at 10:40, Christoph Czurda wrote:
> 
>> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>>> Hi Christoph,
>>>
>>> Could we have a look at the full DN you're using?
>> Sure, here it is:
>> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>>>
>>> Thanks,
>>> Pierre-Arnaud
>>>
>>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>>>
>>>> Hello!
>>>>
>>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>>>
>>>> Testing connection.exists(Dn dn) returns false.
>>>> When I test the String overload with the same dn I get true.
>>>>
>>>> The code can probably explain better than words:
>>>>
>>>> Dn dn;
>>>> //dn is initialized with an existing Dn.
>>>>
>>>> //this test passes:
>>>> assertThat(connection.exists(dn.getName()), is(true));
>>>>
>>>> //this fails. AssertionError: expected true, got false
>>>> assertThat(connection.exists(dn), is(true));
>>>>
>>>> How can that be? exists(Dn) works fine in other tests.
>>>>
>>>> Maybe I should mention that I get lots of these messages:
>>>>
>>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>>> but there are still bytes in the buffer.
>>>>
>>>> But they occur with almost every message sent to the server. Btw, can I
>>>> get rid of them somehow?
>>>>
>>>> Kind regards,
>>>> Christoph
>>>
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Thanks Christoph,

I replicated the whole hierarchy of the DN you gave with standard schema element and I have not been able to reproduce the issue.

As you mentioned in another mail, you're using a custom schema for your own set of Attribute Types and Object Classes.
Would you be allowed to share it with us (even in a private email, not on the ML), so we can replicate the issue and found out more about this strange issue?

Regards,
Pierre-Arnaud


On 1 févr. 2012, at 10:40, Christoph Czurda wrote:

> On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
>> Hi Christoph,
>> 
>> Could we have a look at the full DN you're using?
> Sure, here it is:
> cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
>> 
>> Thanks,
>> Pierre-Arnaud
>> 
>> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
>> 
>>> Hello!
>>> 
>>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>> 
>>> Testing connection.exists(Dn dn) returns false.
>>> When I test the String overload with the same dn I get true.
>>> 
>>> The code can probably explain better than words:
>>> 
>>> Dn dn;
>>> //dn is initialized with an existing Dn.
>>> 
>>> //this test passes:
>>> assertThat(connection.exists(dn.getName()), is(true));
>>> 
>>> //this fails. AssertionError: expected true, got false
>>> assertThat(connection.exists(dn), is(true));
>>> 
>>> How can that be? exists(Dn) works fine in other tests.
>>> 
>>> Maybe I should mention that I get lots of these messages:
>>> 
>>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>>> but there are still bytes in the buffer.
>>> 
>>> But they occur with almost every message sent to the server. Btw, can I
>>> get rid of them somehow?
>>> 
>>> Kind regards,
>>> Christoph
>> 


Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.

On 02/01/2012 10:34 AM, Pierre-Arnaud Marcelot wrote:
> Hi Christoph,
> 
> Could we have a look at the full DN you're using?
Sure, here it is:
cn=testAttribute,ou=attributes,cn=testUser,ou=users,ou=userdata,dc=openengsb,dc=org
> 
> Thanks,
> Pierre-Arnaud
> 
> On 1 févr. 2012, at 06:16, Christoph Czurda wrote:
> 
>> Hello!
>>
>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>
>> Testing connection.exists(Dn dn) returns false.
>> When I test the String overload with the same dn I get true.
>>
>> The code can probably explain better than words:
>>
>> Dn dn;
>> //dn is initialized with an existing Dn.
>>
>> //this test passes:
>> assertThat(connection.exists(dn.getName()), is(true));
>>
>> //this fails. AssertionError: expected true, got false
>> assertThat(connection.exists(dn), is(true));
>>
>> How can that be? exists(Dn) works fine in other tests.
>>
>> Maybe I should mention that I get lots of these messages:
>>
>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>> but there are still bytes in the buffer.
>>
>> But they occur with almost every message sent to the server. Btw, can I
>> get rid of them somehow?
>>
>> Kind regards,
>> Christoph
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Hi Christoph,

Could we have a look at the full DN you're using?

Thanks,
Pierre-Arnaud

On 1 févr. 2012, at 06:16, Christoph Czurda wrote:

> Hello!
> 
> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
> 
> Testing connection.exists(Dn dn) returns false.
> When I test the String overload with the same dn I get true.
> 
> The code can probably explain better than words:
> 
> Dn dn;
> //dn is initialized with an existing Dn.
> 
> //this test passes:
> assertThat(connection.exists(dn.getName()), is(true));
> 
> //this fails. AssertionError: expected true, got false
> assertThat(connection.exists(dn), is(true));
> 
> How can that be? exists(Dn) works fine in other tests.
> 
> Maybe I should mention that I get lots of these messages:
> 
> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
> org.apache.directory.shared.asn1.ber.Asn1Decoder -
> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
> but there are still bytes in the buffer.
> 
> But they occur with almost every message sent to the server. Btw, can I
> get rid of them somehow?
> 
> Kind regards,
> Christoph


Re: connection.exists(Dn) is false although entry exists

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/1/12 11:21 AM, Christoph Czurda wrote:
> Hi Emmanuel,
>
> Thanks for your reply. I'm sure your suggestion solves my problem,
> however there is more to it.
>
> I have a question about connection.loadSchema() but I asked it in
> another email (header is Re: custom schema objects) because it does not
> fit this topic.

Currently replying the other thread :)


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: connection.exists(Dn) is false although entry exists

Posted by Christoph Czurda <ha...@gmail.com>.
Hi Emmanuel,

Thanks for your reply. I'm sure your suggestion solves my problem,
however there is more to it.

I have a question about connection.loadSchema() but I asked it in
another email (header is Re: custom schema objects) because it does not
fit this topic.

kind regards,
Christoph

On 02/01/2012 09:57 AM, Emmanuel Lecharny wrote:
> On 2/1/12 6:16 AM, Christoph Czurda wrote:
>> Hello!
> 
> Hi,
> 
> 
>>
>> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>>
>> Testing connection.exists(Dn dn) returns false.
>> When I test the String overload with the same dn I get true.
>>
>> The code can probably explain better than words:
>>
>> Dn dn;
>> //dn is initialized with an existing Dn.
>>
>> //this test passes:
>> assertThat(connection.exists(dn.getName()), is(true));
>>
>> //this fails. AssertionError: expected true, got false
>> assertThat(connection.exists(dn), is(true));
> 
> Its likely that your connection is not schema aware. Try to load the
> schemas when defining your connection :
> 
> connection.loadSchema();
> 
> (note that we changed the name of this function in trunk, it's now
> connection.loadDefaultSchema() :
> 
> https://issues.apache.org/jira/browse/DIRAPI-58
> 
> );
> 
> 
>> Maybe I should mention that I get lots of these messages:
>>
>> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
>> org.apache.directory.shared.asn1.ber.Asn1Decoder -
>> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
>> but there are still bytes in the buffer.
> 
> There is a bug that has been fixed yesterday :
> https://issues.apache.org/jira/browse/DIRAPI-70
> 
> We will most certainly vote a new release this week.
> 

Re: connection.exists(Dn) is false although entry exists

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/1/12 6:16 AM, Christoph Czurda wrote:
> Hello!

Hi,


>
> I came accross a strange issue in a unit test. (server ApacheDS 2.0)
>
> Testing connection.exists(Dn dn) returns false.
> When I test the String overload with the same dn I get true.
>
> The code can probably explain better than words:
>
> Dn dn;
> //dn is initialized with an existing Dn.
>
> //this test passes:
> assertThat(connection.exists(dn.getName()), is(true));
>
> //this fails. AssertionError: expected true, got false
> assertThat(connection.exists(dn), is(true));

Its likely that your connection is not schema aware. Try to load the 
schemas when defining your connection :

connection.loadSchema();

(note that we changed the name of this function in trunk, it's now 
connection.loadDefaultSchema() :

https://issues.apache.org/jira/browse/DIRAPI-58

);


> Maybe I should mention that I get lots of these messages:
>
> 2012-02-01 05:56:00,730 [NioProcessor-2] WARN
> org.apache.directory.shared.asn1.ber.Asn1Decoder -
> ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU The PDU has been fully decoded
> but there are still bytes in the buffer.

There is a bug that has been fixed yesterday : 
https://issues.apache.org/jira/browse/DIRAPI-70

We will most certainly vote a new release this week.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com