You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2012/04/07 21:57:20 UTC

svn commit: r1310848 - /jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java

Author: pmouawad
Date: Sat Apr  7 19:57:19 2012
New Revision: 1310848

URL: http://svn.apache.org/viewvc?rev=1310848&view=rev
Log:
Bug 53042 - Introduce a new Interface to be implemented by AbstractSampler to allow Sampler to decide wether a config element applies to Sampler

Make LDAPSampler only merge 3 config elements

Modified:
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java

Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java?rev=1310848&r1=1310847&r2=1310848&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java (original)
+++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java Sat Apr  7 19:57:19 2012
@@ -18,6 +18,10 @@
 
 package org.apache.jmeter.protocol.ldap.sampler;
 
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.BasicAttribute;
@@ -31,6 +35,7 @@ import org.apache.jmeter.config.ConfigTe
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.Entry;
 import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.testelement.property.StringProperty;
@@ -48,6 +53,12 @@ public class LDAPSampler extends Abstrac
 
     private static final long serialVersionUID = 240L;
 
+    private static final Set<String> APPLIABLE_CONFIG_CLASSES = new HashSet<String>(
+            Arrays.asList(new String[]{
+                    "org.apache.jmeter.config.gui.LoginConfigGui",
+                    "org.apache.jmeter.protocol.ldap.config.gui.LdapConfigGui",
+                    "org.apache.jmeter.config.gui.SimpleConfigGui"}));
+    
     public static final String SERVERNAME = "servername"; //$NON-NLS-1$
 
     public static final String PORT = "port"; //$NON-NLS-1$
@@ -467,4 +478,13 @@ public class LDAPSampler extends Abstrac
         res.setSuccessful(isSuccessful);
         return res;
     }
+    
+    /**
+     * @see org.apache.jmeter.samplers.AbstractSampler#applies(org.apache.jmeter.config.ConfigTestElement)
+     */
+    @Override
+    public boolean applies(ConfigTestElement configElement) {
+        String guiClass = configElement.getProperty(TestElement.GUI_CLASS).getStringValue();
+        return APPLIABLE_CONFIG_CLASSES.contains(guiClass);
+    }
 }
\ No newline at end of file