jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1310833 - /jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
Date Sat, 07 Apr 2012 19:34:55 GMT
Author: pmouawad
Date: Sat Apr  7 19:34:55 2012
New Revision: 1310833

URL: http://svn.apache.org/viewvc?rev=1310833&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 Java Sampler only merge 2 config elements

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

Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java?rev=1310833&r1=1310832&r2=1310833&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
(original)
+++ jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
Sat Apr  7 19:34:55 2012
@@ -18,11 +18,13 @@
 
 package org.apache.jmeter.protocol.java.sampler;
 
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.engine.event.LoopIterationEvent;
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.Entry;
@@ -45,6 +47,11 @@ public class JavaSampler extends Abstrac
 
     private static final long serialVersionUID = 232L; // Remember to change this when the
class changes ...
 
+    private static final Set<String> APPLIABLE_CONFIG_CLASSES = new HashSet<String>(
+            Arrays.asList(new String[]{
+                    "org.apache.jmeter.protocol.java.config.gui.JavaConfigGui",
+                    "org.apache.jmeter.config.gui.SimpleConfigGui"}));
+
     /**
      * Property key representing the classname of the JavaSamplerClient to user.
      */
@@ -284,4 +291,12 @@ public class JavaSampler extends Abstrac
             return results;
         }
     }
+
+    /**
+     * @see org.apache.jmeter.samplers.AbstractSampler#applies(org.apache.jmeter.config.ConfigTestElement)
+     */
+    public boolean applies(ConfigTestElement configElement) {
+        String guiClass = configElement.getProperty(TestElement.GUI_CLASS).getStringValue();
+        return APPLIABLE_CONFIG_CLASSES.contains(guiClass);
+    }
 }



Mime
View raw message