You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/06/19 03:26:51 UTC
svn commit: r669350 -
/jakarta/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
Author: sebb
Date: Wed Jun 18 18:26:51 2008
New Revision: 669350
URL: http://svn.apache.org/viewvc?rev=669350&view=rev
Log:
Include retrieval of search items in sample time
Check if search was successful even if not retrieving any data.
Close enumerations just in case
Modified:
jakarta/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
Modified: jakarta/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java?rev=669350&r1=669349&r2=669350&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java Wed Jun 18 18:26:51 2008
@@ -716,6 +716,7 @@
res.setResponseData("successfull".getBytes());
res.setResponseMessage("Success"); // $NON-NLS-1$
res.setResponseCode("0"); // $NON-NLS-1$
+ res.setContentType("text/xml");// $NON-NLS-1$
boolean isSuccessful = true;
res.setSampleLabel(getName());
LdapExtClient temp_client = (LdapExtClient) ldapConnections.get(getThreadName());
@@ -757,19 +758,22 @@
+ getPropertyAsString(COMPAREDN));
xmlBuffer.tag("comparedn",getPropertyAsString(COMPAREDN)); // $NON-NLS-1$
xmlBuffer.tag("comparefilter",getPropertyAsString(COMPAREFILT)); // $NON-NLS-1$
- NamingEnumeration cmp;
+ NamingEnumeration cmp=null;
try {
res.sampleStart();
cmp = temp_client.compare(dirContext, getPropertyAsString(COMPAREFILT),
getPropertyAsString(COMPAREDN));
+ if (!cmp.hasMore()) {
+ res.setResponseCode("5"); // $NON-NLS-1$
+ res.setResponseMessage("compareFalse");
+ isSuccessful = false;
+ }
} finally {
res.sampleEnd();
+ if (cmp != null) {
+ cmp.close();
+ }
}
- if (!cmp.hasMore()) {
- res.setResponseCode("5"); // $NON-NLS-1$
- res.setResponseMessage("compareFalse");
- isSuccessful = false;
- }
} else if (testType.equals(ADD)) {
res.setSamplerData("Add object " + getBaseEntryDN());
xmlBuffer.tag("attributes",getArguments().toString()); // $NON-NLS-1$
@@ -805,7 +809,7 @@
xmlBuffer.tag("countlimit",countLimit); // $NON-NLS-1$
xmlBuffer.tag("timelimit",timeLimit); // $NON-NLS-1$
- NamingEnumeration srch;
+ NamingEnumeration srch=null;
try {
res.sampleStart();
srch = temp_client.searchTest(
@@ -815,18 +819,24 @@
getRequestAttributes(getAttrs()),
isRetobj(),
isDeref());
+ if (isParseFlag()) {
+ try {
+ xmlBuffer.openTag("searchresults"); // $NON-NLS-1$
+ writeSearchResults(xmlBuffer, srch);
+ } finally {
+ xmlBuffer.closeTag("searchresults"); // $NON-NLS-1$
+ }
+ } else {
+ xmlBuffer.tag("searchresults", // $NON-NLS-1$
+ "hasElements="+srch.hasMoreElements()); // $NON-NLS-1$
+ }
} finally {
+ if (srch != null){
+ srch.close();
+ }
res.sampleEnd();
}
- if (isParseFlag()) {
- try {
- xmlBuffer.openTag("searchresults"); // $NON-NLS-1$
- writeSearchResults(xmlBuffer, srch);
- } finally {
- xmlBuffer.closeTag("searchresults"); // $NON-NLS-1$
- }
- }
}
} catch (NamingException ex) {
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org