jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1718727 - in /jmeter/trunk: src/components/org/apache/jmeter/assertions/ src/components/org/apache/jmeter/assertions/gui/ src/core/org/apache/jmeter/config/ src/core/org/apache/jmeter/engine/util/ src/core/org/apache/jmeter/gui/action/ src...
Date Tue, 08 Dec 2015 22:25:49 GMT
Author: pmouawad
Date: Tue Dec  8 22:25:49 2015
New Revision: 1718727

URL: http://svn.apache.org/viewvc?rev=1718727&view=rev
Log:
Bug 58705 - Make org.apache.jmeter.testelement.property.MultiProperty iterable
#resolve #48
Bugzilla Id: 58705

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
    jmeter/trunk/src/core/org/apache/jmeter/config/Arguments.java
    jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/TestBeanHelper.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MultiProperty.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/property/PropertyIterator.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPArgument.java
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperties.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java Tue Dec
 8 22:25:49 2015
@@ -29,7 +29,6 @@ import org.apache.jmeter.testelement.pro
 import org.apache.jmeter.testelement.property.IntegerProperty;
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.NullProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.testelement.property.StringProperty;
 import org.apache.jmeter.util.Document;
 import org.apache.jmeter.util.JMeterUtils;
@@ -349,9 +348,8 @@ public class ResponseAssertion extends A
         try {
             // Get the Matcher for this thread
             Perl5Matcher localMatcher = JMeterUtils.getMatcher();
-            PropertyIterator iter = getTestStrings().iterator();
-            while (iter.hasNext()) {
-                String stringPattern = iter.next().getStringValue();
+            for (JMeterProperty jMeterProperty : getTestStrings()) {
+                String stringPattern = jMeterProperty.getStringValue();
                 Pattern pattern = null;
                 if (contains || matches) {
                     pattern = JMeterUtils.getPatternCache().getPattern(stringPattern, Perl5Compiler.READ_ONLY_MASK);

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java Tue Dec
 8 22:25:49 2015
@@ -39,7 +39,7 @@ import org.apache.jmeter.gui.util.PowerT
 import org.apache.jmeter.gui.util.TextAreaCellRenderer;
 import org.apache.jmeter.gui.util.TextAreaTableCellEditor;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.gui.GuiUtils;
 
@@ -250,9 +250,8 @@ public class AssertionGui extends Abstra
         assumeSuccess.setSelected(model.getAssumeSuccess());
 
         tableModel.clearData();
-        PropertyIterator tests = model.getTestStrings().iterator();
-        while (tests.hasNext()) {
-            tableModel.addRow(new Object[] { tests.next().getStringValue() });
+        for (JMeterProperty jMeterProperty : model.getTestStrings()) {
+            tableModel.addRow(new Object[] { jMeterProperty.getStringValue() });
         }
 
         if (model.getTestStrings().size() == 0) {

Modified: jmeter/trunk/src/core/org/apache/jmeter/config/Arguments.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/config/Arguments.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/config/Arguments.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/config/Arguments.java Tue Dec  8 22:25:49 2015
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.jmeter.testelement.property.CollectionProperty;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.testelement.property.TestElementProperty;
 
@@ -32,7 +33,7 @@ import org.apache.jmeter.testelement.pro
  * A set of Argument objects.
  *
  */
-public class Arguments extends ConfigTestElement implements Serializable {
+public class Arguments extends ConfigTestElement implements Serializable, Iterable<JMeterProperty>
{
     private static final long serialVersionUID = 240L;
 
     /** The name of the property used to store the arguments. */
@@ -141,6 +142,7 @@ public class Arguments extends ConfigTes
      *
      * @return an iteration of the arguments
      */
+    @Override
     public PropertyIterator iterator() {
         return getArguments().iterator();
     }

Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java Tue Dec  8 22:25:49
2015
@@ -20,7 +20,6 @@ package org.apache.jmeter.engine.util;
 
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -68,11 +67,11 @@ public class CompoundVariable implements
             if (notContain!=null){
                 log.info("Note: Function class names must not contain the string: '"+notContain+"'");
             }
+            
             List<String> classes = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
                     new Class[] { Function.class }, true, contain, notContain);
-            Iterator<String> iter = classes.iterator();
-            while (iter.hasNext()) {
-                Function tempFunc = (Function) Class.forName(iter.next()).newInstance();
+            for (String clazzName : classes) {
+                Function tempFunc = (Function) Class.forName(clazzName).newInstance();
                 String referenceKey = tempFunc.getReferenceKey();
                 if (referenceKey.length() > 0) { // ignore self
                     functions.put(referenceKey, tempFunc.getClass());
@@ -82,8 +81,9 @@ public class CompoundVariable implements
                     }
                 }
             }
+            
             final int functionCount = functions.size();
-            if (functionCount == 0){
+            if (functionCount == 0) {
                 log.warn("Did not find any functions");
             } else {
                 log.debug("Function count: "+functionCount);
@@ -134,6 +134,7 @@ public class CompoundVariable implements
         if (compiledComponents == null || compiledComponents.size() == 0) {
             return ""; // $NON-NLS-1$
         }
+        
         StringBuilder results = new StringBuilder();
         for (Object item : compiledComponents) {
             if (item instanceof Function) {

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java Tue Dec  8 22:25:49
2015
@@ -24,7 +24,6 @@ import java.awt.Font;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -216,8 +215,7 @@ public class SearchTreeDialog extends JD
         GuiPackage guiInstance = GuiPackage.getInstance();
         JTree jTree = guiInstance.getMainFrame().getTree();
 
-        for (Iterator<JMeterTreeNode> iterator = nodes.iterator(); iterator.hasNext();)
{
-            JMeterTreeNode jMeterTreeNode = iterator.next();
+        for (JMeterTreeNode jMeterTreeNode : nodes) {
             jMeterTreeNode.setMarkedBySearch(true);
             if (expand) {
                 jTree.expandPath(new TreePath(jMeterTreeNode.getPath()));

Modified: jmeter/trunk/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java Tue
Dec  8 22:25:49 2015
@@ -22,14 +22,13 @@ import org.apache.jmeter.testelement.pro
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.MapProperty;
 import org.apache.jmeter.testelement.property.MultiProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
 
-import com.thoughtworks.xstream.mapper.Mapper;
 import com.thoughtworks.xstream.converters.MarshallingContext;
 import com.thoughtworks.xstream.converters.UnmarshallingContext;
 import com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter;
 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.mapper.Mapper;
 
 public class MultiPropertyConverter extends AbstractCollectionConverter {
 
@@ -53,12 +52,11 @@ public class MultiPropertyConverter exte
     @Override
     public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext
context) {
         MultiProperty prop = (MultiProperty) arg0;
+        
         writer.addAttribute(ConversionHelp.ATT_NAME, ConversionHelp.encode(prop.getName()));
-        PropertyIterator iter = prop.iterator();
-        while (iter.hasNext()) {
-            writeItem(iter.next(), context, writer);
+        for (JMeterProperty jMeterProperty : prop) {
+            writeItem(jMeterProperty, context, writer);
         }
-
     }
 
     /** {@inheritDoc} */

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/TestBeanHelper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/TestBeanHelper.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/TestBeanHelper.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/TestBeanHelper.java Tue Dec  8 22:25:49
2015
@@ -133,20 +133,16 @@ public class TestBeanHelper {
         return value;
     }
 
-    private static Object unwrapCollection(MultiProperty prop,String type)
+    private static Object unwrapCollection(MultiProperty prop, String type)
     {
         if(prop instanceof CollectionProperty)
         {
             Collection<Object> values = new LinkedList<>();
-            PropertyIterator iter = prop.iterator();
-            while(iter.hasNext())
-            {
-                try
-                {
-                    values.add(unwrapProperty(null,iter.next(),Class.forName(type)));
+            for (JMeterProperty jMeterProperty : prop) {
+                try {
+                    values.add(unwrapProperty(null, jMeterProperty, Class.forName(type)));
                 }
-                catch(Exception e)
-                {
+                catch(Exception e) {
                     log.error("Couldn't convert object: " + prop.getObjectValue() + " to
" + type,e);
                 }
             }

Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MultiProperty.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MultiProperty.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MultiProperty.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MultiProperty.java Tue Dec
 8 22:25:49 2015
@@ -26,7 +26,7 @@ import org.apache.jmeter.testelement.Tes
  *
  * @version $Revision$
  */
-public abstract class MultiProperty extends AbstractProperty {
+public abstract class MultiProperty extends AbstractProperty implements Iterable<JMeterProperty>
{
     private static final long serialVersionUID = 240L;
 
     public MultiProperty() {
@@ -43,6 +43,7 @@ public abstract class MultiProperty exte
      *
      * @return an iterator for the sub-values of this property
      */
+    @Override
     public abstract PropertyIterator iterator();
 
     /**

Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/property/PropertyIterator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/property/PropertyIterator.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testelement/property/PropertyIterator.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testelement/property/PropertyIterator.java Tue
Dec  8 22:25:49 2015
@@ -18,10 +18,16 @@
 
 package org.apache.jmeter.testelement.property;
 
-public interface PropertyIterator {
+import java.util.Iterator;
+
+public interface PropertyIterator extends Iterator<JMeterProperty> {
+    
+    @Override
     boolean hasNext();
 
+    @Override
     JMeterProperty next();
 
+    @Override
     void remove();
 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
Tue Dec  8 22:25:49 2015
@@ -49,7 +49,7 @@ import org.apache.jmeter.protocol.http.u
 import org.apache.jmeter.testelement.TestIterationListener;
 import org.apache.jmeter.testelement.TestStateListener;
 import org.apache.jmeter.testelement.property.CollectionProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.TestElementProperty;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
@@ -235,10 +235,10 @@ public class AuthManager extends ConfigT
             s2 = url2.toString();
         }
 
-            log.debug("Target URL strings to match against: "+s1+" and "+s2);
+        log.debug("Target URL strings to match against: "+s1+" and "+s2);
         // TODO should really return most specific (i.e. longest) match.
-        for (PropertyIterator iter = getAuthObjects().iterator(); iter.hasNext();) {
-            Authorization auth = (Authorization) iter.next().getObjectValue();
+        for (JMeterProperty jMeterProperty : getAuthObjects()) {
+            Authorization auth = (Authorization) jMeterProperty.getObjectValue();
 
             String uRL = auth.getURL();
             log.debug("Checking match against auth'n entry: "+uRL);
@@ -291,11 +291,10 @@ public class AuthManager extends ConfigT
      * @param newAuthorization authorization to be added
      */
     public void addAuth(Authorization newAuthorization) {
-        boolean alreadyExists=false;
-        PropertyIterator iter = getAuthObjects().iterator();
+        boolean alreadyExists = false;
         //iterate over authentication objects in manager
-        while (iter.hasNext()) {
-            Authorization authorization = (Authorization) iter.next().getObjectValue();
+        for (JMeterProperty jMeterProperty : getAuthObjects()) {
+            Authorization authorization = (Authorization) jMeterProperty.getObjectValue();
             if (authorization == null) {
                 continue;
             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
Tue Dec  8 22:25:49 2015
@@ -37,6 +37,7 @@ import org.apache.jmeter.testelement.Tes
 import org.apache.jmeter.testelement.TestStateListener;
 import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jmeter.testelement.property.CollectionProperty;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.util.JMeterUtils;
@@ -169,19 +170,18 @@ public class CookieManager extends Confi
             file = new File(System.getProperty("user.dir") // $NON-NLS-1$
                     + File.separator + authFile);
         }
-        PrintWriter writer = new PrintWriter(new FileWriter(file)); // TODO Charset ?
-        writer.println("# JMeter generated Cookie file");// $NON-NLS-1$
-        PropertyIterator cookies = getCookies().iterator();
-        long now = System.currentTimeMillis();
-        while (cookies.hasNext()) {
-            Cookie cook = (Cookie) cookies.next().getObjectValue();
-            final long expiresMillis = cook.getExpiresMillis();
-            if (expiresMillis == 0 || expiresMillis > now) { // only save unexpired cookies
-                writer.println(cookieToString(cook));
+        try(PrintWriter writer = new PrintWriter(new FileWriter(file))) { // TODO Charset
?
+            writer.println("# JMeter generated Cookie file");// $NON-NLS-1$
+            long now = System.currentTimeMillis();
+            for (JMeterProperty jMeterProperty : getCookies()) {
+                Cookie cook = (Cookie) jMeterProperty.getObjectValue();
+                final long expiresMillis = cook.getExpiresMillis();
+                if (expiresMillis == 0 || expiresMillis > now) { // only save unexpired
cookies
+                    writer.println(cookieToString(cook));
+                }
             }
+            writer.flush();
         }
-        writer.flush();
-        writer.close();
     }
 
     /**

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/DNSCacheManager.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
Tue Dec  8 22:25:49 2015
@@ -32,7 +32,7 @@ import org.apache.jmeter.engine.event.Lo
 import org.apache.jmeter.testelement.TestIterationListener;
 import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jmeter.testelement.property.CollectionProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
@@ -104,10 +104,9 @@ public class DNSCacheManager extends Con
         CollectionProperty dnsServers = getServers();
         try {
             String[] serverNames = new String[dnsServers.size()];
-            PropertyIterator dnsServIt = dnsServers.iterator();
-            int index=0;
-            while (dnsServIt.hasNext()) {
-                serverNames[index] = dnsServIt.next().getStringValue();
+            int index = 0;
+            for (JMeterProperty jMeterProperty : dnsServers) {
+                serverNames[index] = jMeterProperty.getStringValue();
                 index++;
             }
             clone.resolver = new ExtendedResolver(serverNames);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java
Tue Dec  8 22:25:49 2015
@@ -26,7 +26,7 @@ import org.apache.commons.httpclient.coo
 import org.apache.commons.httpclient.cookie.MalformedCookieException;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.testelement.property.CollectionProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -82,9 +82,9 @@ public class HC3CookieHandler implements
             boolean allowVariableCookie){
         org.apache.commons.httpclient.Cookie cookies[]=
             new org.apache.commons.httpclient.Cookie[cookiesCP.size()];
-        int i=0;
-        for (PropertyIterator iter = cookiesCP.iterator(); iter.hasNext();) {
-            Cookie jmcookie = (Cookie) iter.next().getObjectValue();
+        int i = 0;
+        for (JMeterProperty jMeterProperty : cookiesCP) {
+            Cookie jmcookie = (Cookie) jMeterProperty.getObjectValue();
             // Set to running version, to allow function evaluation for the cookie values
(bug 28715)
             if (allowVariableCookie) {
                 jmcookie.setRunningVersion(true);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java
Tue Dec  8 22:25:49 2015
@@ -41,7 +41,7 @@ import org.apache.http.message.BasicHead
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.testelement.property.CollectionProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -168,8 +168,8 @@ public class HC4CookieHandler implements
             CollectionProperty cookiesCP, URL url, boolean allowVariableCookie) {
         List<org.apache.http.cookie.Cookie> cookies = new ArrayList<>();
 
-        for (PropertyIterator iter = cookiesCP.iterator(); iter.hasNext();) {
-            Cookie jmcookie = (Cookie) iter.next().getObjectValue();
+        for (JMeterProperty jMeterProperty : cookiesCP) {
+            Cookie jmcookie = (Cookie) jMeterProperty.getObjectValue();
             // Set to running version, to allow function evaluation for the cookie values
(bug 28715)
             if (allowVariableCookie) {
                 jmcookie.setRunningVersion(true);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java Tue
Dec  8 22:25:49 2015
@@ -50,7 +50,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.CookieManager;
 import org.apache.jmeter.protocol.http.control.HC3CookieHandler;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.gui.JLabeledChoice;
@@ -293,9 +293,8 @@ public class CookiePanel extends Abstrac
 
     private void populateTable(CookieManager manager) {
         tableModel.clearData();
-        PropertyIterator iter = manager.getCookies().iterator();
-        while (iter.hasNext()) {
-            addCookieToTable((Cookie) iter.next().getObjectValue());
+        for (JMeterProperty jMeterProperty : manager.getCookies()) {
+            addCookieToTable((Cookie) jMeterProperty.getObjectValue());
         }
     }
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
Tue Dec  8 22:25:49 2015
@@ -38,7 +38,7 @@ import org.apache.jmeter.config.gui.Abst
 import org.apache.jmeter.gui.util.PowerTableModel;
 import org.apache.jmeter.protocol.http.control.DNSCacheManager;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.gui.layout.VerticalLayout;
@@ -146,9 +146,8 @@ public class DNSCachePanel extends Abstr
 
     private void populateTable(DNSCacheManager resolver) {
         dnsServersTableModel.clearData();
-        PropertyIterator iter = resolver.getServers().iterator();
-        while (iter.hasNext()) {
-            addServerToTable((String) iter.next().getObjectValue());
+        for (JMeterProperty jMeterProperty : resolver.getServers()) {
+            addServerToTable((String) jMeterProperty.getObjectValue());
         }
     }
 

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=1718727&r1=1718726&r2=1718727&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
Tue Dec  8 22:25:49 2015
@@ -1322,9 +1322,8 @@ public abstract class HTTPSamplerBase ex
                             binRes = future.get(1, TimeUnit.MILLISECONDS);
                             if(cookieManager != null) {
                                 CollectionProperty cookies = binRes.getCookies();
-                                PropertyIterator iter = cookies.iterator();
-                                while (iter.hasNext()) {
-                                    Cookie cookie = (Cookie) iter.next().getObjectValue();
+                                for (JMeterProperty jMeterProperty : cookies) {
+                                    Cookie cookie = (Cookie) jMeterProperty.getObjectValue();
                                     cookieManager.add(cookie) ;
                                 }
                             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPArgument.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPArgument.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPArgument.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPArgument.java
Tue Dec  8 22:25:49 2015
@@ -27,7 +27,7 @@ import java.util.List;
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.testelement.property.BooleanProperty;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -253,9 +253,8 @@ public class HTTPArgument extends Argume
      */
     public static void convertArgumentsToHTTP(Arguments args) {
         List<Argument> newArguments = new LinkedList<>();
-        PropertyIterator iter = args.getArguments().iterator();
-        while (iter.hasNext()) {
-            Argument arg = (Argument) iter.next().getObjectValue();
+        for (JMeterProperty jMeterProperty : args.getArguments()) {
+            Argument arg = (Argument) jMeterProperty.getObjectValue();
             if (!(arg instanceof HTTPArgument)) {
                 newArguments.add(new HTTPArgument(arg));
             } else {

Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
(original)
+++ jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
Tue Dec  8 22:25:49 2015
@@ -42,10 +42,10 @@ import org.apache.jmeter.protocol.java.c
 import org.apache.jmeter.protocol.java.sampler.JavaSampler;
 import org.apache.jmeter.protocol.java.sampler.JavaSamplerClient;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jorphan.reflect.ClassFinder;
 import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.reflect.ClassFinder;
 import org.apache.log.Logger;
 
 /**
@@ -184,9 +184,8 @@ public class JavaConfigGui extends Abstr
                 }
 
                 if (testParams != null) {
-                    PropertyIterator i = testParams.getArguments().iterator();
-                    while (i.hasNext()) {
-                        Argument arg = (Argument) i.next().getObjectValue();
+                    for (JMeterProperty jMeterProperty : testParams.getArguments()) {
+                        Argument arg = (Argument) jMeterProperty.getObjectValue();
                         String name = arg.getName();
                         String value = arg.getValue();
 

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperties.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperties.java?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperties.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperties.java
Tue Dec  8 22:25:49 2015
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import org.apache.jmeter.testelement.AbstractTestElement;
 import org.apache.jmeter.testelement.property.CollectionProperty;
+import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.testelement.property.TestElementProperty;
 
@@ -84,15 +85,13 @@ public class JMSProperties extends Abstr
      * @return a new Map with String keys and values containing the JmsProperties
      */
     public Map<String, Object> getJmsPropertysAsMap() {
-        PropertyIterator iter = getProperties().iterator();
         Map<String, Object> argMap = new LinkedHashMap<>();
-        while (iter.hasNext()) {
-            JMSProperty arg = (JMSProperty) iter.next().getObjectValue();
+        for (JMeterProperty jMeterProperty : getProperties()) {
+            JMSProperty arg = (JMSProperty) jMeterProperty.getObjectValue();
             // Because CollectionProperty.mergeIn will not prevent adding two
             // properties of the same name, we need to select the first value so
             // that this element's values prevail over defaults provided by
-            // configuration
-            // elements:
+            // configuration elements:
             if (!argMap.containsKey(arg.getName())) {
                 argMap.put(arg.getName(), arg.getValueAsObject());
             }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1718727&r1=1718726&r2=1718727&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Tue Dec  8 22:25:49 2015
@@ -161,6 +161,7 @@ Summary
 <li><bug>57981</bug>Require a minimum of Java 7. Partly contributed by
Graham Russell (jmeter at ham1.co.uk)</li>
 <li><bug>58684</bug>JMeterColor does not need to extend java.awt.Color.
Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
 <li><bug>58687</bug>ButtonPanel should die. Contributed by Benoit Wiart
(benoit dot wiart at gmail.com)</li>
+<li><bug>58705</bug>Make org.apache.jmeter.testelement.property.MultiProperty
iterable. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
 </ul>
  
  <!-- =================== Bug fixes =================== -->



Mime
View raw message