On 28 Oct 2003 at 7:31, Dolf Smits wrote:

> Hi Kane,
> 
> It's interesting to see how many people use the LDAP sampler 
adn find
> problems with it.

That's because it's a brand new sampler.  Give it time to mature 
and stabilize.

-Mike

> 
> I met these problems as well, and build a new sampler, which can 
be used in
> cooperation with the current one.
> However, the code is not submitted, so you have to stick with the 
old one, I
> jope yoyr patches will be submitted.
> 
> If you want to have a look at my extended sampler, please do so. 
it can be
> found on:
> 
> http://www.home.zonnet.nl/dolfsmits
> 
> please let me know what you think of it.
> 
> Dolf Smits
> 
> 
> ----- Original Message -----
> From: "Mcgladrey, Kayne" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, October 27, 2003 19:53
> Subject: Proposed patch for LDAPSampler.java
> 
> 
> This is my second proposed patch; it's more involved and 
probably breaks the
> standard LDAP test cases. No CVS check in for this one - if 
someone could
> check how/if this breaks the standard test cases, I'll consider 
checking it
> in.
> 
> Reason for patch:
> Attributes on Directory Servers can be either single-valued or 
multi-valued.
> The default LDAPSampler.java only allows for single-valued 
attributes due to
> the getUserAttributes() method. If you define four mail attributes, 
only the
> last one will be kept on the attrs structure.
> 
> Additionally, not all objects on LDAP servers have the full set of 
object
> classes defined in getUserAttributes().
> 
> Suggested patch:
> This patch substantially changes the getUserAttributes() method. 
A base
> objectclass of top is kept as all entries in a Directory must inherit 
top.
> However, all other attributes and values must be entered by the 
user. This
> probably breaks the default add test.
> 
> The while loop has been modified to check for two possibilities:
> 1. The attribute matches the last one. In this case, add the value.
> 2. The attribute doesn't match the last one. In this case, check if 
the
> attribute has already been put() on the attrs structure.
>   If it has been, add the new value to that attribute.
>   If it has not been, it's a completely new attribute. Add the 
attribute and
> the value to attrs.
> 
> Actual code:
>     public BasicAttributes getUserAttributes() {
>         boolean add =true;
>         BasicAttributes attrs = new BasicAttributes(true);
>         PropertyIterator iter = getArguments().iterator();
> 
>         String lastSeen = "objectclass";
> BasicAttribute attr = new BasicAttribute("objectclass");
> attr.add("top");
> attrs.put(attr);
> while (iter.hasNext()) {
>             Argument item = (Argument) iter.next().getObjectValue();
>     String current = item.getName();
>     if ( lastSeen.equalsIgnoreCase(current) ) {
>                 attr.add( item.getValue() );
>             } else {
> //check if it's already been added to the attrs
> Attribute oldAttr = attrs.get(current);
> if (oldAttr == null) {
> //this one is completely new, so add it to attrs
>         attrs.put(attr);
> //make a note of it
> lastSeen = current;
> //get the next one
> attr = getBasicAttribute( item.getName(),item.getValue());
> } else {
> oldAttr.add( item.getValue() );
> //overwrite existing value
> attrs.remove(current);
> attrs.put(oldAttr);
> lastSeen = current;
> }
>             }
>         }
> //put the last one
> attrs.put(attr);
>         return attrs;
>     }
> 
> Regards,
> 
> 
> Kayne McGladrey
> AT&T Wireless
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-
[EMAIL PROTECTED]
> For additional commands, e-mail: jmeter-dev-
[EMAIL PROTECTED]
> 




--
Michael Stover
[EMAIL PROTECTED]
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to