jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1310863 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Date Sat, 07 Apr 2012 20:54:30 GMT
Author: pmouawad
Date: Sat Apr  7 20:54:30 2012
New Revision: 1310863

URL: http://svn.apache.org/viewvc?rev=1310863&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 HttpSampler only merge related config elements

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

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1310863&r1=1310862&r2=1310863&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Sat Apr  7 20:54:30 2012
@@ -29,9 +29,11 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
@@ -44,6 +46,7 @@ import java.util.concurrent.TimeoutExcep
 import org.apache.commons.lang.StringUtils;
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.engine.event.LoopIterationEvent;
 import org.apache.jmeter.protocol.http.control.AuthManager;
 import org.apache.jmeter.protocol.http.control.CacheManager;
@@ -94,6 +97,16 @@ public abstract class HTTPSamplerBase ex
 
     private static final Logger log = LoggingManager.getLoggerForClass();
 
+    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.http.config.gui.HttpDefaultsGui",
+                    "org.apache.jmeter.config.gui.SimpleConfigGui",
+                    "org.apache.jmeter.protocol.http.gui.HeaderPanel",
+                    "org.apache.jmeter.protocol.http.gui.AuthPanel",
+                    "org.apache.jmeter.protocol.http.gui.CacheManagerGui",
+                    "org.apache.jmeter.protocol.http.gui.CookiePanel"}));
+    
     //+ JMX names - do not change
     public static final String ARGUMENTS = "HTTPsampler.Arguments"; // $NON-NLS-1$
 
@@ -1860,4 +1873,13 @@ public abstract class HTTPSamplerBase ex
         }
         return result;
     }
+    
+    /**
+     * @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



Mime
View raw message