You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/11/02 17:30:40 UTC

svn commit: r1030113 - in /jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads: SamplePackage.java TestCompiler.java

Author: sebb
Date: Tue Nov  2 16:30:40 2010
New Revision: 1030113

URL: http://svn.apache.org/viewvc?rev=1030113&view=rev
Log:
Drop unused Lists

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/SamplePackage.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/SamplePackage.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/SamplePackage.java?rev=1030113&r1=1030112&r2=1030113&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/SamplePackage.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/SamplePackage.java Tue Nov  2 16:30:40 2010
@@ -19,7 +19,6 @@
 package org.apache.jmeter.threads;
 
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.jmeter.assertions.Assertion;
@@ -30,53 +29,37 @@ import org.apache.jmeter.samplers.Sample
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.timers.Timer;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
 
 /**
  * Packages methods related to sample handling.
  */
 public class SamplePackage {
-    private static final Logger log = LoggingManager.getLoggerForClass();
 
-    private List<SampleListener> sampleListeners = new LinkedList<SampleListener>();
+    private final List<SampleListener> sampleListeners;
 
-    private List<Timer> timers = new LinkedList<Timer>();
+    private final List<Timer> timers;
 
-    private List<Assertion> assertions = new LinkedList<Assertion>();
+    private final List<Assertion> assertions;
 
-    private List<PostProcessor> postProcessors = new LinkedList<PostProcessor>();
+    private final List<PostProcessor> postProcessors;
 
-    private List<PreProcessor> preProcessors = new LinkedList<PreProcessor>();
+    private final List<PreProcessor> preProcessors;
 
-    // TODO the following lists don't seem to be used at present
-    private List<?> responseModifiers;
+    private final List<ConfigTestElement> configs;
 
-    private List<ConfigTestElement> configs;
-
-    private List<?> modifiers;
-
-    private List<TestElement> controllers;
+    private final List<TestElement> controllers;
 
     private Sampler sampler;
 
-    public SamplePackage() {
-    }
-
     public SamplePackage(
             List<ConfigTestElement> configs,
-            List<?> modifiers,
-            List<?> responseModifiers, 
             List<SampleListener> listeners,
             List<Timer> timers,
             List<Assertion> assertions, 
             List<PostProcessor> postProcessors, 
             List<PreProcessor> preProcessors,
             List<TestElement> controllers) {
-        log.debug("configs is null: " + (configs == null));
         this.configs = configs;
-        this.modifiers = modifiers;
-        this.responseModifiers = responseModifiers;
         this.sampleListeners = listeners;
         this.timers = timers;
         this.assertions = assertions;
@@ -85,46 +68,40 @@ public class SamplePackage {
         this.controllers = controllers;
     }
 
+    @SuppressWarnings("unchecked") // All implementations extend TestElement
     public void setRunningVersion(boolean running) {
         setRunningVersion(configs, running);
-        setRunningVersion(modifiers, running);
-        setRunningVersion(sampleListeners, running);
-        setRunningVersion(assertions, running);
-        setRunningVersion(timers, running);
-        setRunningVersion(responseModifiers, running);
-        setRunningVersion(postProcessors, running);
-        setRunningVersion(preProcessors, running);
+        setRunningVersion((List<? extends TestElement>) sampleListeners, running);
+        setRunningVersion((List<? extends TestElement>) assertions, running);
+        setRunningVersion((List<? extends TestElement>) timers, running);
+        setRunningVersion((List<? extends TestElement>) postProcessors, running);
+        setRunningVersion((List<? extends TestElement>) preProcessors, running);
         setRunningVersion(controllers, running);
         sampler.setRunningVersion(running);
     }
 
-    // TODO: Unfortunately, few of the test element interfaces implement TestElement
-    // (though all the implementation classes do)
-    @SuppressWarnings("unchecked")
-    private void setRunningVersion(List<?> list, boolean running) {
-        Iterator<TestElement> iter = (Iterator<TestElement>) list.iterator();
+    private void setRunningVersion(List<? extends TestElement> list, boolean running) {
+        Iterator<? extends TestElement> iter = list.iterator();
         while (iter.hasNext()) {
             iter.next().setRunningVersion(running);
         }
     }
 
-    @SuppressWarnings("unchecked")
-    private void recoverRunningVersion(List<?> list) {
-        Iterator<TestElement> iter = (Iterator<TestElement>) list.iterator();
+    private void recoverRunningVersion(List<? extends TestElement> list) {
+        Iterator<? extends TestElement> iter = list.iterator();
         while (iter.hasNext()) {
             iter.next().recoverRunningVersion();
         }
     }
 
+    @SuppressWarnings("unchecked") // All implementations extend TestElement
     public void recoverRunningVersion() {
         recoverRunningVersion(configs);
-        recoverRunningVersion(modifiers);
-        recoverRunningVersion(sampleListeners);
-        recoverRunningVersion(assertions);
-        recoverRunningVersion(timers);
-        recoverRunningVersion(responseModifiers);
-        recoverRunningVersion(postProcessors);
-        recoverRunningVersion(preProcessors);
+        recoverRunningVersion((List<? extends TestElement>) sampleListeners);
+        recoverRunningVersion((List<? extends TestElement>) assertions);
+        recoverRunningVersion((List<? extends TestElement>) timers);
+        recoverRunningVersion((List<? extends TestElement>) postProcessors);
+        recoverRunningVersion((List<? extends TestElement>) preProcessors);
         recoverRunningVersion(controllers);
         sampler.recoverRunningVersion();
     }
@@ -181,16 +158,6 @@ public class SamplePackage {
     }
 
     /**
-     * Sets the preProcessors.
-     *
-     * @param preProcessors
-     *            the preProcessors to set
-     */
-    public void setPreProcessors(List<PreProcessor> preProcessors) {
-        this.preProcessors = preProcessors;
-    }
-
-    /**
      * Returns the configs.
      *
      * @return List
@@ -199,87 +166,4 @@ public class SamplePackage {
         return configs;
     }
 
-    /**
-     * Returns the modifiers.
-     */
-    public List<?> getModifiers() {
-        return modifiers;
-    }
-
-    /**
-     * Returns the responseModifiers.
-     */
-    public List<?> getResponseModifiers() {
-        return responseModifiers;
-    }
-
-    /**
-     * Sets the assertions.
-     *
-     * @param assertions
-     *            the assertions to set
-     */
-    public void setAssertions(List<Assertion> assertions) {
-        this.assertions = assertions;
-    }
-
-    /**
-     * Sets the configs.
-     *
-     * @param configs
-     *            the configs to set
-     */
-    public void setConfigs(List<ConfigTestElement> configs) {
-        this.configs = configs;
-    }
-
-    /**
-     * Sets the modifiers.
-     *
-     * @param modifiers
-     *            the modifiers to set
-     */
-    public void setModifiers(List<?> modifiers) {
-        this.modifiers = modifiers;
-    }
-
-    /**
-     * Sets the postProcessors.
-     *
-     * @param postProcessors
-     *            the postProcessors to set
-     */
-    public void setPostProcessors(List<PostProcessor> postProcessors) {
-        this.postProcessors = postProcessors;
-    }
-
-    /**
-     * Sets the responseModifiers.
-     *
-     * @param responseModifiers
-     *            the responseModifiers to set
-     */
-    public void setResponseModifiers(List<?> responseModifiers) {
-        this.responseModifiers = responseModifiers;
-    }
-
-    /**
-     * Sets the sampleListeners.
-     *
-     * @param sampleListeners
-     *            the sampleListeners to set
-     */
-    public void setSampleListeners(List<SampleListener> sampleListeners) {
-        this.sampleListeners = sampleListeners;
-    }
-
-    /**
-     * Sets the timers.
-     *
-     * @param timers
-     *            the timers to set
-     */
-    public void setTimers(List<Timer> timers) {
-        this.timers = timers;
-    }
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java?rev=1030113&r1=1030112&r2=1030113&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java Tue Nov  2 16:30:40 2010
@@ -151,9 +151,7 @@ public class TestCompiler implements Has
 
     private void saveSamplerConfigs(Sampler sam) {
         List<ConfigTestElement> configs = new LinkedList<ConfigTestElement>();
-        List<?> modifiers = new LinkedList<Object>();
         List<TestElement> controllers = new LinkedList<TestElement>();
-        List<?> responseModifiers = new LinkedList<Object>();
         List<SampleListener> listeners = new LinkedList<SampleListener>();
         List<Timer> timers = new LinkedList<Timer>();
         List<Assertion> assertions = new LinkedList<Assertion>();
@@ -189,7 +187,7 @@ public class TestCompiler implements Has
             posts.addAll(0, tempPost);
         }
 
-        SamplePackage pack = new SamplePackage(configs, modifiers, responseModifiers, listeners, timers, assertions,
+        SamplePackage pack = new SamplePackage(configs, listeners, timers, assertions,
                 posts, pres, controllers);
         pack.setSampler(sam);
         pack.setRunningVersion(true);
@@ -198,9 +196,7 @@ public class TestCompiler implements Has
 
     private void saveTransactionControllerConfigs(TransactionController tc) {
         List<ConfigTestElement> configs = new LinkedList<ConfigTestElement>();
-        List<?> modifiers = new LinkedList<Object>();
         List<TestElement> controllers = new LinkedList<TestElement>();
-        List<?> responseModifiers = new LinkedList<Object>();
         List<SampleListener> listeners = new LinkedList<SampleListener>();
         List<Timer> timers = new LinkedList<Timer>();
         List<Assertion> assertions = new LinkedList<Assertion>();
@@ -220,7 +216,7 @@ public class TestCompiler implements Has
             }
         }
 
-        SamplePackage pack = new SamplePackage(configs, modifiers, responseModifiers, listeners, timers, assertions,
+        SamplePackage pack = new SamplePackage(configs, listeners, timers, assertions,
                 posts, pres, controllers);
         pack.setSampler(new TransactionSampler(tc, tc.getName()));
         pack.setRunningVersion(true);



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org