You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/11/14 22:58:09 UTC

svn commit: r836271 - in /jakarta/jmeter/trunk: src/components/org/apache/jmeter/assertions/ src/components/org/apache/jmeter/extractor/ src/components/org/apache/jmeter/modifiers/ src/components/org/apache/jmeter/visualizers/ src/core/org/apache/jmete...

Author: sebb
Date: Sat Nov 14 21:58:09 2009
New Revision: 836271

URL: http://svn.apache.org/viewvc?rev=836271&view=rev
Log:
Tab police

Modified:
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertion.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertionBeanInfo.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/SubstitutionElement.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/JSR223PostProcessor.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/JSR223PreProcessor.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/TreeNodeRenderer.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/assertions/CompareAssertionResult.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java
    jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
    jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertion.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertion.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertion.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertion.java Sat Nov 14 21:58:09 2009
@@ -34,99 +34,99 @@
 import org.apache.oro.text.regex.Util;
 
 public class CompareAssertion extends AbstractTestElement implements Assertion, TestBean, Serializable,
-		LoopIterationListener {
+        LoopIterationListener {
 
     private static final long serialVersionUID = 240L;
     
-	private transient List<SampleResult> responses;
+    private transient List<SampleResult> responses;
 
-	private transient final StringSubstitution emptySub = new StringSubstitution(""); //$NON-NLS-1$
+    private transient final StringSubstitution emptySub = new StringSubstitution(""); //$NON-NLS-1$
 
-	private boolean compareContent = true;
+    private boolean compareContent = true;
 
-	private long compareTime = -1;
+    private long compareTime = -1;
 
-	private Collection<SubstitutionElement> stringsToSkip;
-
-	public CompareAssertion() {
-		super();
-	}
-
-	public AssertionResult getResult(SampleResult response) {
-		responses.add(response);
-		if (responses.size() > 1) {
-			CompareAssertionResult result = new CompareAssertionResult(getName());
-			compareContent(result);
-			compareTime(result);
-			return result;
-		} else
-			return new AssertionResult(getName());
-	}
-
-	private void compareTime(CompareAssertionResult result) {
-		if (compareTime >= 0) {
-			Iterator<SampleResult> iter = responses.iterator();
-			long prevTime = -1;
-			SampleResult prevResult = null;
-			boolean success = true;
-			while (iter.hasNext()) {
-				SampleResult sResult = iter.next();
-				long currentTime = sResult.getTime();
-				if (prevTime != -1) {
-					success = Math.abs(prevTime - currentTime) <= compareTime;
-					prevResult = sResult;
-				}
-				if (!success) {
-					result.setFailure(true);
+    private Collection<SubstitutionElement> stringsToSkip;
+
+    public CompareAssertion() {
+        super();
+    }
+
+    public AssertionResult getResult(SampleResult response) {
+        responses.add(response);
+        if (responses.size() > 1) {
+            CompareAssertionResult result = new CompareAssertionResult(getName());
+            compareContent(result);
+            compareTime(result);
+            return result;
+        } else
+            return new AssertionResult(getName());
+    }
+
+    private void compareTime(CompareAssertionResult result) {
+        if (compareTime >= 0) {
+            Iterator<SampleResult> iter = responses.iterator();
+            long prevTime = -1;
+            SampleResult prevResult = null;
+            boolean success = true;
+            while (iter.hasNext()) {
+                SampleResult sResult = iter.next();
+                long currentTime = sResult.getTime();
+                if (prevTime != -1) {
+                    success = Math.abs(prevTime - currentTime) <= compareTime;
+                    prevResult = sResult;
+                }
+                if (!success) {
+                    result.setFailure(true);
                     StringBuilder buf = new StringBuilder();
                     appendResultDetails(buf, prevResult);
                     buf.append(JMeterUtils.getResString("comparison_response_time")).append(prevTime);
-					result.addToBaseResult(buf.toString());
-					buf = new StringBuilder();
+                    result.addToBaseResult(buf.toString());
+                    buf = new StringBuilder();
                     appendResultDetails(buf, sResult);
                     buf.append(JMeterUtils.getResString("comparison_response_time")).append(currentTime);
-					result.addToSecondaryResult(buf.toString());
+                    result.addToSecondaryResult(buf.toString());
                    result.setFailureMessage(JMeterUtils.getResString("comparison_differ_time") //$NON-NLS-1$
                            +compareTime+JMeterUtils.getResString("comparison_unit")); //$NON-NLS-1$
-					break;
-				}
-				prevResult = sResult;
-				prevTime = currentTime;
-			}
-		}
-	}
+                    break;
+                }
+                prevResult = sResult;
+                prevTime = currentTime;
+            }
+        }
+    }
 
     private void compareContent(CompareAssertionResult result) {
-		if (compareContent) {
-			Iterator<SampleResult> iter = responses.iterator();
-			String prevContent = null;
-			SampleResult prevResult = null;
-			boolean success = true;
-			while (iter.hasNext()) {
-				SampleResult sResult = iter.next();
-				String currentContent = sResult.getResponseDataAsString();
-				currentContent = filterString(currentContent);
-				if (prevContent != null) {
-					success = prevContent.equals(currentContent);
-				}
-				if (!success) {
-					result.setFailure(true);
-					StringBuilder buf = new StringBuilder();
+        if (compareContent) {
+            Iterator<SampleResult> iter = responses.iterator();
+            String prevContent = null;
+            SampleResult prevResult = null;
+            boolean success = true;
+            while (iter.hasNext()) {
+                SampleResult sResult = iter.next();
+                String currentContent = sResult.getResponseDataAsString();
+                currentContent = filterString(currentContent);
+                if (prevContent != null) {
+                    success = prevContent.equals(currentContent);
+                }
+                if (!success) {
+                    result.setFailure(true);
+                    StringBuilder buf = new StringBuilder();
                     appendResultDetails(buf, prevResult);
-					buf.append(prevContent);
-					result.addToBaseResult(buf.toString());
-					buf = new StringBuilder();
-					appendResultDetails(buf, sResult);
-					buf.append(currentContent);
-					result.addToSecondaryResult(buf.toString());
-					result.setFailureMessage(JMeterUtils.getResString("comparison_differ_content")); //$NON-NLS-1$
-					break;
-				}
-				prevResult = sResult;
-				prevContent = currentContent;
-			}
-		}
-	}
+                    buf.append(prevContent);
+                    result.addToBaseResult(buf.toString());
+                    buf = new StringBuilder();
+                    appendResultDetails(buf, sResult);
+                    buf.append(currentContent);
+                    result.addToSecondaryResult(buf.toString());
+                    result.setFailureMessage(JMeterUtils.getResString("comparison_differ_content")); //$NON-NLS-1$
+                    break;
+                }
+                prevResult = sResult;
+                prevContent = currentContent;
+            }
+        }
+    }
 
     private void appendResultDetails(StringBuilder buf, SampleResult result) {
         final String samplerData = result.getSamplerData();
@@ -141,70 +141,70 @@
         buf.append("\n\n"); //$NON-NLS-1$
     }
 
-	private String filterString(String content) {
-		if (stringsToSkip == null || stringsToSkip.size() == 0) {
-			return content;
-		} else {
-			for (SubstitutionElement regex : stringsToSkip) {
-				emptySub.setSubstitution(regex.getSubstitute());
-				content = Util.substitute(JMeterUtils.getMatcher(), JMeterUtils.getPatternCache().getPattern(regex.getRegex()),
-						emptySub, content, Util.SUBSTITUTE_ALL);
-			}
-		}
-		return content;
-	}
-
-	public void iterationStart(LoopIterationEvent iterEvent) {
-		responses = new LinkedList<SampleResult>();
-	}
-
-	public void iterationEnd(LoopIterationEvent iterEvent) {
-		responses = null;
-	}
-
-	/**
-	 * @return Returns the compareContent.
-	 */
-	public boolean isCompareContent() {
-		return compareContent;
-	}
-
-	/**
-	 * @param compareContent
-	 *            The compareContent to set.
-	 */
-	public void setCompareContent(boolean compareContent) {
-		this.compareContent = compareContent;
-	}
-
-	/**
-	 * @return Returns the compareTime.
-	 */
-	public long getCompareTime() {
-		return compareTime;
-	}
-
-	/**
-	 * @param compareTime
-	 *            The compareTime to set.
-	 */
-	public void setCompareTime(long compareTime) {
-		this.compareTime = compareTime;
-	}
-
-	/**
-	 * @return Returns the stringsToSkip.
-	 */
-	public Collection<SubstitutionElement> getStringsToSkip() {
-		return stringsToSkip;
-	}
-
-	/**
-	 * @param stringsToSkip
-	 *            The stringsToSkip to set.
-	 */
-	public void setStringsToSkip(Collection<SubstitutionElement> stringsToSkip) {
-		this.stringsToSkip = stringsToSkip;
-	}
+    private String filterString(String content) {
+        if (stringsToSkip == null || stringsToSkip.size() == 0) {
+            return content;
+        } else {
+            for (SubstitutionElement regex : stringsToSkip) {
+                emptySub.setSubstitution(regex.getSubstitute());
+                content = Util.substitute(JMeterUtils.getMatcher(), JMeterUtils.getPatternCache().getPattern(regex.getRegex()),
+                        emptySub, content, Util.SUBSTITUTE_ALL);
+            }
+        }
+        return content;
+    }
+
+    public void iterationStart(LoopIterationEvent iterEvent) {
+        responses = new LinkedList<SampleResult>();
+    }
+
+    public void iterationEnd(LoopIterationEvent iterEvent) {
+        responses = null;
+    }
+
+    /**
+     * @return Returns the compareContent.
+     */
+    public boolean isCompareContent() {
+        return compareContent;
+    }
+
+    /**
+     * @param compareContent
+     *            The compareContent to set.
+     */
+    public void setCompareContent(boolean compareContent) {
+        this.compareContent = compareContent;
+    }
+
+    /**
+     * @return Returns the compareTime.
+     */
+    public long getCompareTime() {
+        return compareTime;
+    }
+
+    /**
+     * @param compareTime
+     *            The compareTime to set.
+     */
+    public void setCompareTime(long compareTime) {
+        this.compareTime = compareTime;
+    }
+
+    /**
+     * @return Returns the stringsToSkip.
+     */
+    public Collection<SubstitutionElement> getStringsToSkip() {
+        return stringsToSkip;
+    }
+
+    /**
+     * @param stringsToSkip
+     *            The stringsToSkip to set.
+     */
+    public void setStringsToSkip(Collection<SubstitutionElement> stringsToSkip) {
+        this.stringsToSkip = stringsToSkip;
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertionBeanInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertionBeanInfo.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertionBeanInfo.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/CompareAssertionBeanInfo.java Sat Nov 14 21:58:09 2009
@@ -27,30 +27,30 @@
 
 public class CompareAssertionBeanInfo extends BeanInfoSupport {
 
-	public CompareAssertionBeanInfo() {
-		super(CompareAssertion.class);
-		createPropertyGroup("compareChoices", new String[] { "compareContent", "compareTime" }); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+    public CompareAssertionBeanInfo() {
+        super(CompareAssertion.class);
+        createPropertyGroup("compareChoices", new String[] { "compareContent", "compareTime" }); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
         createPropertyGroup("comparison_filters", new String[]{"stringsToSkip"}); //$NON-NLS-1$ $NON-NLS-2$
         PropertyDescriptor p = property("compareContent"); //$NON-NLS-1$
-		p.setValue(NOT_UNDEFINED, Boolean.TRUE);
-		p.setValue(DEFAULT, Boolean.TRUE);
-		p.setValue(NOT_EXPRESSION, Boolean.TRUE);
-		p = property("compareTime"); //$NON-NLS-1$
-		p.setValue(NOT_UNDEFINED, Boolean.TRUE);
-		p.setValue(DEFAULT, new Long(-1));
-		p.setValue(NOT_EXPRESSION, Boolean.FALSE);	
-		p = property("stringsToSkip"); //$NON-NLS-1$
-		p.setPropertyEditorClass(TableEditor.class);
-		p.setValue(TableEditor.CLASSNAME,SubstitutionElement.class.getName());
-		p.setValue(TableEditor.HEADERS,new String[]{
-		        JMeterUtils.getResString("comparison_regex_string"), //$NON-NLS-1$
-		        JMeterUtils.getResString("comparison_regex_substitution")}); //$NON-NLS-1$
-		p.setValue(TableEditor.OBJECT_PROPERTIES, // These are the names of the get/set methods
-		        new String[]{SubstitutionElement.REGEX, SubstitutionElement.SUBSTITUTE});
-		p.setValue(NOT_UNDEFINED,Boolean.TRUE);
-		p.setValue(DEFAULT,new ArrayList<Object>());
-		p.setValue(MULTILINE,Boolean.TRUE);
-		
-	}
+        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
+        p.setValue(DEFAULT, Boolean.TRUE);
+        p.setValue(NOT_EXPRESSION, Boolean.TRUE);
+        p = property("compareTime"); //$NON-NLS-1$
+        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
+        p.setValue(DEFAULT, new Long(-1));
+        p.setValue(NOT_EXPRESSION, Boolean.FALSE);    
+        p = property("stringsToSkip"); //$NON-NLS-1$
+        p.setPropertyEditorClass(TableEditor.class);
+        p.setValue(TableEditor.CLASSNAME,SubstitutionElement.class.getName());
+        p.setValue(TableEditor.HEADERS,new String[]{
+                JMeterUtils.getResString("comparison_regex_string"), //$NON-NLS-1$
+                JMeterUtils.getResString("comparison_regex_substitution")}); //$NON-NLS-1$
+        p.setValue(TableEditor.OBJECT_PROPERTIES, // These are the names of the get/set methods
+                new String[]{SubstitutionElement.REGEX, SubstitutionElement.SUBSTITUTE});
+        p.setValue(NOT_UNDEFINED,Boolean.TRUE);
+        p.setValue(DEFAULT,new ArrayList<Object>());
+        p.setValue(MULTILINE,Boolean.TRUE);
+        
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/SubstitutionElement.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/SubstitutionElement.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/SubstitutionElement.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/SubstitutionElement.java Sat Nov 14 21:58:09 2009
@@ -21,37 +21,37 @@
 import org.apache.jmeter.testelement.AbstractTestElement;
 
 public class SubstitutionElement extends AbstractTestElement {
-	private static final long serialVersionUID = 1;
-	
-	// These constants are used both for the JMX file and for the setters/getters
-	public static final String REGEX = "regex"; // $NON-NLS-1$
-	
-	public static final String SUBSTITUTE = "substitute"; // $NON-NLS-1$
+    private static final long serialVersionUID = 1;
+    
+    // These constants are used both for the JMX file and for the setters/getters
+    public static final String REGEX = "regex"; // $NON-NLS-1$
+    
+    public static final String SUBSTITUTE = "substitute"; // $NON-NLS-1$
 
-	public SubstitutionElement() {
-		super();
-	}
-	
-	public String getRegex()
-	{
-		return getProperty(REGEX).getStringValue();
-	}
-	
-	public void setRegex(String regex)
-	{
-		setProperty(REGEX,regex);
-	}
-	
-	public String getSubstitute()
-	{
-		return getProperty(SUBSTITUTE).getStringValue();
-	}
-	
-	public void setSubstitute(String sub)
-	{
-		setProperty(SUBSTITUTE,sub);
-	}
-	
-	
+    public SubstitutionElement() {
+        super();
+    }
+    
+    public String getRegex()
+    {
+        return getProperty(REGEX).getStringValue();
+    }
+    
+    public void setRegex(String regex)
+    {
+        setProperty(REGEX,regex);
+    }
+    
+    public String getSubstitute()
+    {
+        return getProperty(SUBSTITUTE).getStringValue();
+    }
+    
+    public void setSubstitute(String sub)
+    {
+        setProperty(SUBSTITUTE,sub);
+    }
+    
+    
 
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/JSR223PostProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/JSR223PostProcessor.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/JSR223PostProcessor.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/JSR223PostProcessor.java Sat Nov 14 21:58:09 2009
@@ -36,15 +36,15 @@
     private static final long serialVersionUID = 232L;
 
     public void process() {
-    	
+
         try {
-        	ScriptEngineManager sem = getManager();
-        	if(sem == null) { return; }
-    		processFileOrScript(sem);
+            ScriptEngineManager sem = getManager();
+            if(sem == null) { return; }
+            processFileOrScript(sem);
         } catch (ScriptException e) {
             log.warn("Problem in JSR223 script "+e);
-    	} catch (IOException e) {
+        } catch (IOException e) {
             log.warn("Problem in JSR223 script "+e);
-		}
+        }
     }
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/JSR223PreProcessor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/JSR223PreProcessor.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/JSR223PreProcessor.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/JSR223PreProcessor.java Sat Nov 14 21:58:09 2009
@@ -38,13 +38,13 @@
     public void process() {
 
         try {
-        	ScriptEngineManager sem = getManager();
-        	if(sem == null) { return; }
-        	processFileOrScript(sem);
+            ScriptEngineManager sem = getManager();
+            if(sem == null) { return; }
+            processFileOrScript(sem);
         } catch (ScriptException e) {
             log.warn("Problem in JSR223 script "+e);
         } catch (IOException e) {
             log.warn("Problem in JSR223 script "+e);
-		}
+        }
     }
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java Sat Nov 14 21:58:09 2009
@@ -43,125 +43,124 @@
 import org.apache.jmeter.visualizers.gui.AbstractVisualizer;
 
 public class ComparisonVisualizer extends AbstractVisualizer implements Clearable {
-	private JTree resultsTree;
+    private JTree resultsTree;
 
-	private DefaultTreeModel treeModel;
+    private DefaultTreeModel treeModel;
 
-	private DefaultMutableTreeNode root;
+    private DefaultMutableTreeNode root;
 
-	private JTextPane base, secondary;
+    private JTextPane base, secondary;
 
-	public ComparisonVisualizer() {
-		super();
-		init();
-	}
-
-	public void add(SampleResult sample) {
-
-		DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(sample);
-		treeModel.insertNodeInto(currNode, root, root.getChildCount());
-		if (root.getChildCount() == 1) {
-			resultsTree.expandPath(new TreePath(root));
-		}
-	}
-
-	public String getLabelResource() {
-		return "comparison_visualizer_title"; //$NON-NLS-1$
-	}
-
-	private void init() {
-		setLayout(new BorderLayout());
-		setBorder(makeBorder());
-		add(makeTitlePanel(), BorderLayout.NORTH);
-		JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
-		split.add(getTreePanel());
-		split.add(getSideBySidePanel());
-		add(split, BorderLayout.CENTER);
-	}
-
-	private JComponent getSideBySidePanel() {
-		JPanel main = new JPanel(new GridLayout(1, 2));
-		JScrollPane base = new JScrollPane(getBaseTextPane());
-		base.setPreferredSize(base.getMinimumSize());
-		JScrollPane secondary = new JScrollPane(getSecondaryTextPane());
-		secondary.setPreferredSize(secondary.getMinimumSize());
-		main.add(base);
-		main.add(secondary);
-		main.setPreferredSize(main.getMinimumSize());
-		return main;
-	}
-
-	private JTextPane getBaseTextPane() {
-		base = new JTextPane();
-		base.setEditable(false);
-		base.setBackground(getBackground());
-		return base;
-	}
-
-	private JTextPane getSecondaryTextPane() {
-		secondary = new JTextPane();
-		secondary.setEditable(false);
-		return secondary;
-	}
-
-	private JComponent getTreePanel() {
-		root = new DefaultMutableTreeNode("Root"); //$NON-NLS-1$
-		treeModel = new DefaultTreeModel(root);
-		resultsTree = new JTree(treeModel);
-		resultsTree.setCellRenderer(new TreeNodeRenderer());
-		resultsTree.setCellRenderer(new TreeNodeRenderer());
-		resultsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-		resultsTree.addTreeSelectionListener(new Selector());
-		resultsTree.setRootVisible(false);
-		resultsTree.setShowsRootHandles(true);
-
-		JScrollPane treePane = new JScrollPane(resultsTree);
-		treePane.setPreferredSize(new Dimension(150, 50));
-		JPanel panel = new JPanel(new GridLayout(1, 1));
-		panel.add(treePane);
-		return panel;
-	}
-
-	private class Selector implements TreeSelectionListener {
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
-		 */
-		public void valueChanged(TreeSelectionEvent e) {
-			try {
-				DefaultMutableTreeNode node = (DefaultMutableTreeNode) resultsTree.getLastSelectedPathComponent();
-				SampleResult sr = (SampleResult) node.getUserObject();
-				AssertionResult[] results = sr.getAssertionResults();
-				CompareAssertionResult result = null;
-				for (AssertionResult r : results) {
-					if (r instanceof CompareAssertionResult) {
-						result = (CompareAssertionResult) r;
-						break;
-					}
-				}
-				if (result == null)
-					result = new CompareAssertionResult();
-				base.setText(result.getBaseResult());
-				secondary.setText(result.getSecondaryResult());
-			} catch (Exception err) {
+    public ComparisonVisualizer() {
+        super();
+        init();
+    }
+
+    public void add(SampleResult sample) {
+
+        DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(sample);
+        treeModel.insertNodeInto(currNode, root, root.getChildCount());
+        if (root.getChildCount() == 1) {
+            resultsTree.expandPath(new TreePath(root));
+        }
+    }
+
+    public String getLabelResource() {
+        return "comparison_visualizer_title"; //$NON-NLS-1$
+    }
+
+    private void init() {
+        setLayout(new BorderLayout());
+        setBorder(makeBorder());
+        add(makeTitlePanel(), BorderLayout.NORTH);
+        JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+        split.add(getTreePanel());
+        split.add(getSideBySidePanel());
+        add(split, BorderLayout.CENTER);
+    }
+
+    private JComponent getSideBySidePanel() {
+        JPanel main = new JPanel(new GridLayout(1, 2));
+        JScrollPane base = new JScrollPane(getBaseTextPane());
+        base.setPreferredSize(base.getMinimumSize());
+        JScrollPane secondary = new JScrollPane(getSecondaryTextPane());
+        secondary.setPreferredSize(secondary.getMinimumSize());
+        main.add(base);
+        main.add(secondary);
+        main.setPreferredSize(main.getMinimumSize());
+        return main;
+    }
+
+    private JTextPane getBaseTextPane() {
+        base = new JTextPane();
+        base.setEditable(false);
+        base.setBackground(getBackground());
+        return base;
+    }
+
+    private JTextPane getSecondaryTextPane() {
+        secondary = new JTextPane();
+        secondary.setEditable(false);
+        return secondary;
+    }
+
+    private JComponent getTreePanel() {
+        root = new DefaultMutableTreeNode("Root"); //$NON-NLS-1$
+        treeModel = new DefaultTreeModel(root);
+        resultsTree = new JTree(treeModel);
+        resultsTree.setCellRenderer(new TreeNodeRenderer());
+        resultsTree.setCellRenderer(new TreeNodeRenderer());
+        resultsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+        resultsTree.addTreeSelectionListener(new Selector());
+        resultsTree.setRootVisible(false);
+        resultsTree.setShowsRootHandles(true);
+
+        JScrollPane treePane = new JScrollPane(resultsTree);
+        treePane.setPreferredSize(new Dimension(150, 50));
+        JPanel panel = new JPanel(new GridLayout(1, 1));
+        panel.add(treePane);
+        return panel;
+    }
+
+    private class Selector implements TreeSelectionListener {
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
+         */
+        public void valueChanged(TreeSelectionEvent e) {
+            try {
+                DefaultMutableTreeNode node = (DefaultMutableTreeNode) resultsTree.getLastSelectedPathComponent();
+                SampleResult sr = (SampleResult) node.getUserObject();
+                AssertionResult[] results = sr.getAssertionResults();
+                CompareAssertionResult result = null;
+                for (AssertionResult r : results) {
+                    if (r instanceof CompareAssertionResult) {
+                        result = (CompareAssertionResult) r;
+                        break;
+                    }
+                }
+                if (result == null)
+                    result = new CompareAssertionResult();
+                base.setText(result.getBaseResult());
+                secondary.setText(result.getSecondaryResult());
+            } catch (Exception err) {
                 base.setText(JMeterUtils.getResString("comparison_invalid_node") + err); //$NON-NLS-1$
                 secondary.setText(JMeterUtils.getResString("comparison_invalid_node") + err); //$NON-NLS-1$
-			}
-			base.setCaretPosition(0);
-			secondary.setCaretPosition(0);
-		}
-
-	}
-
-	public void clearData() {
-		while (root.getChildCount() > 0) {
-			// the child to be removed will always be 0 'cos as the nodes are
-			// removed the nth node will become (n-1)th
-			treeModel.removeNodeFromParent((DefaultMutableTreeNode) root.getChildAt(0));
+            }
+            base.setCaretPosition(0);
+            secondary.setCaretPosition(0);
+        }
+    }
+
+    public void clearData() {
+        while (root.getChildCount() > 0) {
+            // the child to be removed will always be 0 'cos as the nodes are
+            // removed the nth node will become (n-1)th
+            treeModel.removeNodeFromParent((DefaultMutableTreeNode) root.getChildAt(0));
             base.setText(""); //$NON-NLS-1$
             secondary.setText(""); //$NON-NLS-1$
-		}
-	}
+        }
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/TreeNodeRenderer.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/TreeNodeRenderer.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/TreeNodeRenderer.java Sat Nov 14 21:58:09 2009
@@ -45,25 +45,25 @@
             JMeterUtils.getPropDefault("viewResultsTree.failure",  //$NON-NLS-1$
                     "icon_warning_sml.gif")); //$NON-NLS-1$
     
-	public TreeNodeRenderer() {
-		super();
-	}
-	
-	@Override
+    public TreeNodeRenderer() {
+        super();
+    }
+
+    @Override
     public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
-			boolean leaf, int row, boolean focus) {
-		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, focus);
-		Object obj = ((DefaultMutableTreeNode) value).getUserObject();
-		if(obj instanceof SampleResult)
-		{
-			if (!((SampleResult) obj).isSuccessful()) {
-				this.setForeground(Color.red);
+            boolean leaf, int row, boolean focus) {
+        super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, focus);
+        Object obj = ((DefaultMutableTreeNode) value).getUserObject();
+        if(obj instanceof SampleResult)
+        {
+            if (!((SampleResult) obj).isSuccessful()) {
+                this.setForeground(Color.red);
                 this.setIcon(imageFailure);
             } else {
                 this.setIcon(imageSuccess);
-			}
-		}
-		return this;
-	}
+            }
+        }
+        return this;
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/assertions/CompareAssertionResult.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/assertions/CompareAssertionResult.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/assertions/CompareAssertionResult.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/assertions/CompareAssertionResult.java Sat Nov 14 21:58:09 2009
@@ -20,75 +20,74 @@
 
 
 public class CompareAssertionResult extends AssertionResult {
-	private static final long serialVersionUID = 1;
-	
-	private transient final ResultHolder comparedResults = new ResultHolder();
-
-	/**
-	 * For testing only
-	 * @deprecated Use the other ctor
-	 */
-	@Deprecated
+    private static final long serialVersionUID = 1;
+
+    private transient final ResultHolder comparedResults = new ResultHolder();
+
+    /**
+     * For testing only
+     * @deprecated Use the other ctor
+     */
+    @Deprecated
     public CompareAssertionResult() { // needs to be public for testing
-		super();
-	}
+        super();
+    }
+
+    public CompareAssertionResult(String name) {
+        super(name);
+    }
+
+    public void addToBaseResult(String resultData)
+    {
+        comparedResults.addToBaseResult(resultData);
+    }
+
+    public void addToSecondaryResult(String resultData)
+    {
+        comparedResults.addToSecondaryResult(resultData);
+    }
+
+    public String getBaseResult()
+    {
+        return comparedResults.baseResult;
+    }
+
+    public String getSecondaryResult()
+    {
+        return comparedResults.secondaryResult;
+    }
+
+    private static class ResultHolder
+    {
+        private String baseResult;
+        private String secondaryResult;
+
+        public ResultHolder()
+        {
+        }
+
+        public void addToBaseResult(String r)
+        {
+            if(baseResult == null)
+            {
+                baseResult = r;
+            }
+            else
+            {
+                baseResult = baseResult + "\n\n" + r; //$NON-NLS-1$
+            }
+        }
 
-	public CompareAssertionResult(String name) {
-		super(name);
-	}
-	
-	public void addToBaseResult(String resultData)
-	{
-		comparedResults.addToBaseResult(resultData);
-	}
-	
-	public void addToSecondaryResult(String resultData)
-	{
-		comparedResults.addToSecondaryResult(resultData);
-	}
-	
-	public String getBaseResult()
-	{
-		return comparedResults.baseResult;
-	}
-	
-	public String getSecondaryResult()
-	{
-		return comparedResults.secondaryResult;
-	}
-
-	private static class ResultHolder
-	{
-		private String baseResult;
-		private String secondaryResult;
-		
-		public ResultHolder()
-		{
-			
-		}
-		
-		public void addToBaseResult(String r)
-		{
-			if(baseResult == null)
-			{
-				baseResult = r;
-			}
-			else
-			{
-				baseResult = baseResult + "\n\n" + r; //$NON-NLS-1$
-			}
-		}
-		
-		public void addToSecondaryResult(String r)
-		{
-			if(secondaryResult == null)
-			{
-				secondaryResult = r;
-			}
-			else
-			{
-				secondaryResult = secondaryResult + "\n\n" + r; //$NON-NLS-1$
-			}
-		}
-	}
+        public void addToSecondaryResult(String r)
+        {
+            if(secondaryResult == null)
+            {
+                secondaryResult = r;
+            }
+            else
+            {
+                secondaryResult = secondaryResult + "\n\n" + r; //$NON-NLS-1$
+            }
+        }
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java Sat Nov 14 21:58:09 2009
@@ -82,13 +82,13 @@
     }
 
     protected ScriptEngineManager getManager() {
-    	ScriptEngineManager sem = new ScriptEngineManager();
-    	initManager(sem);
-    	return sem;
+        ScriptEngineManager sem = new ScriptEngineManager();
+        initManager(sem);
+        return sem;
     }
 
     protected void initManager(ScriptEngineManager sem) {
-    	final String label = getName();
+        final String label = getName();
         final String fileName = getFilename();
         final String scriptParameters = getParameters();
         // Use actual class name for log
@@ -119,27 +119,27 @@
 
     
     protected Object processFileOrScript(ScriptEngineManager sem) throws IOException, ScriptException {
-    	
-    	final String lang = getScriptLanguage();
+        
+        final String lang = getScriptLanguage();
         ScriptEngine scriptEngine = sem.getEngineByName(lang);
-    	if (scriptEngine == null) {
-    		log.error("Unsupported scripting engine: "+lang);
-    		return null;
-    	}
-    	
-    	File scriptFile = new File(getFilename());
-    	if (scriptFile.exists()) {
-    	    BufferedReader fileReader = null;
-    		try {
+        if (scriptEngine == null) {
+            log.error("Unsupported scripting engine: "+lang);
+            return null;
+        }
+        
+        File scriptFile = new File(getFilename());
+        if (scriptFile.exists()) {
+            BufferedReader fileReader = null;
+            try {
                 fileReader = new BufferedReader(new FileReader(scriptFile));
                 return scriptEngine.eval(fileReader);
             } finally {
                 IOUtils.closeQuietly(fileReader);
             }
-    	} else {
-    		return scriptEngine.eval(getScript());
-    	}
-    	
+        } else {
+            return scriptEngine.eval(getScript());
+        }
+        
     }
 
     /**

Modified: jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java Sat Nov 14 21:58:09 2009
@@ -96,7 +96,7 @@
      *
      */
     private OnMessageSubscriber initListenerClient() {
-    	interrupted = false;
+        interrupted = false;
         OnMessageSubscriber sub = (OnMessageSubscriber) ClientPool.get(this);
         if (sub == null) {
             sub = new OnMessageSubscriber(this.getUseJNDIPropertiesAsBoolean(), this.getJNDIInitialContextFactory(),
@@ -116,7 +116,7 @@
      * Create the ReceiveSubscriber client for the sampler.
      */
     private void initReceiveClient() {
-    	interrupted = false;
+        interrupted = false;
         this.SUBSCRIBER = new ReceiveSubscriber(this.getUseJNDIPropertiesAsBoolean(), this
                 .getJNDIInitialContextFactory(), this.getProviderUrl(), this.getConnectionFactory(), this.getTopic(),
                 this.isUseAuth(), this.getUsername(), this.getPassword());
@@ -289,8 +289,8 @@
      */
     public boolean interrupt() {
         boolean oldvalue = interrupted;
-    	interrupted = true;   // so we break the loops in SampleWithListener and SampleWithReceive
-    	return !oldvalue;
+        interrupted = true;   // so we break the loops in SampleWithListener and SampleWithReceive
+        return !oldvalue;
     }
 
     // This was the old value that was checked for

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java?rev=836271&r1=836270&r2=836271&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java Sat Nov 14 21:58:09 2009
@@ -38,183 +38,183 @@
 import org.apache.jmeter.samplers.SampleResult;
 
 public class TestCacheManager extends JMeterTestCase {
-	
-	private static final String APACHE = "http://jakarta.apache.org/";
-	private static final String EXPECTED_ETAG = "0xCAFEBABEDEADBEEF";
-	private CacheManager cacheManager;
-	private String currentTimeInGMT;
-	private URL url;
-	private URI uri;
-	private URLConnection urlConnection;
-	private HttpMethod httpMethod;
-	private HttpURLConnection httpUrlConnection;
-
-	public TestCacheManager(String name) {
-		super(name);
-	}
+    
+    private static final String APACHE = "http://jakarta.apache.org/";
+    private static final String EXPECTED_ETAG = "0xCAFEBABEDEADBEEF";
+    private CacheManager cacheManager;
+    private String currentTimeInGMT;
+    private URL url;
+    private URI uri;
+    private URLConnection urlConnection;
+    private HttpMethod httpMethod;
+    private HttpURLConnection httpUrlConnection;
+
+    public TestCacheManager(String name) {
+        super(name);
+    }
 
-	@Override
+    @Override
     public void setUp() throws Exception {
-		super.setUp();
-		this.cacheManager = new CacheManager();
-		SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
-		simpleDateFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
-		simpleDateFormat.applyPattern("EEE, dd MMM yyyy HH:mm:ss z");
-		this.currentTimeInGMT = simpleDateFormat.format(new Date());
-		this.uri = new URI(APACHE, false);
-		this.url = new URL(APACHE);
-		this.urlConnection = this.url.openConnection();
-		this.httpMethod = new PostMethod();
-		this.httpUrlConnection = new HttpURLConnection(this.httpMethod, this.url);
-	}
+        super.setUp();
+        this.cacheManager = new CacheManager();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
+        simpleDateFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
+        simpleDateFormat.applyPattern("EEE, dd MMM yyyy HH:mm:ss z");
+        this.currentTimeInGMT = simpleDateFormat.format(new Date());
+        this.uri = new URI(APACHE, false);
+        this.url = new URL(APACHE);
+        this.urlConnection = this.url.openConnection();
+        this.httpMethod = new PostMethod();
+        this.httpUrlConnection = new HttpURLConnection(this.httpMethod, this.url);
+    }
 
-	@Override
+    @Override
     protected void tearDown() throws Exception {
-		this.httpUrlConnection = null;
-		this.httpMethod = null;
-		this.urlConnection = null;
-		this.url = null;
-		this.uri = null;
-		this.cacheManager = null;
-		this.currentTimeInGMT = null;
-		super.tearDown();
-	}
-
-	public void testGetClearEachIteration() throws Exception {
-		assertFalse("Should default not to clear after each iteration.", this.cacheManager.getClearEachIteration());
-		this.cacheManager.setClearEachIteration(true);
-		assertTrue("Should be settable to clear after each iteration.", this.cacheManager.getClearEachIteration());
-		this.cacheManager.setClearEachIteration(false);
-		assertFalse("Should be settable not to clear after each iteration.", this.cacheManager.getClearEachIteration());
-	}
-
-	public void testSaveDetailsWithEmptySampleResultGivesNoCacheEntry() throws Exception {
-		saveDetailsWithConnectionAndSampleResultWithResponseCode("");
-		assertTrue("Saving details with empty SampleResult should not make cache entry.", getThreadCache().isEmpty());
-	}
-
-	public void testSaveDetailsURLConnectionWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
-		saveDetailsWithConnectionAndSampleResultWithResponseCode("200");
-		CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.url.toString());
-		assertNotNull("Saving details with SampleResult & connection with 200 response should make cache entry.", cacheEntry);
-		assertNotNull("Saving details with SampleResult & connection with 200 response should make cache entry with an etag.", cacheEntry.getEtag());
-		assertNotNull("Saving details with SampleResult & connection with 200 response should make cache entry with last modified date.", cacheEntry.getLastModified());
-	}
-
-	public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
-		saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
-		CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.httpMethod.getURI().toString());
-		assertNotNull("Saving SampleResult with HttpMethod & 200 response should make cache entry.", cacheEntry);
-		assertNull("Saving details with SampleResult & HttpMethod with 200 response should make cache entry with no etag.", cacheEntry.getEtag());
-		assertNull("Saving details with SampleResult & HttpMethod with 200 response should make cache entry with no last modified date.", cacheEntry.getLastModified());
-	}
-
-	public void testSaveDetailsURLConnectionWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
-		saveDetailsWithConnectionAndSampleResultWithResponseCode("404");
-		assertNull("Saving details with SampleResult & connection with 404 response should not make cache entry.", getThreadCacheEntry(url.toString()));
-	}
-
-	public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
-		saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
-		assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.httpMethod.getPath()));
-	}
-
-	public void testSetHeadersHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
-		this.httpMethod.setURI(this.uri);
-		this.httpMethod.addRequestHeader(new Header(HTTPConstantsInterface.IF_MODIFIED_SINCE, this.currentTimeInGMT, false));
-		this.httpMethod.addRequestHeader(new Header(HTTPConstantsInterface.ETAG, EXPECTED_ETAG, false));
-		saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
-		setFieldInCacheEntry(getThreadCacheEntry(this.httpMethod.getURI().toString()), "etag", EXPECTED_ETAG);
-		setHeadersWithUrlAndHttpMethod();
-		checkRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, EXPECTED_ETAG);
-		checkRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, this.currentTimeInGMT);
-	}
-
-	public void testSetHeadersHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
-		this.httpMethod.setURI(this.uri);
-		saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
-		setHeadersWithUrlAndHttpMethod();
-		assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.httpMethod.getPath()));
-	}
-
-	public void testSetHeadersHttpURLConnectionWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
-		saveDetailsWithConnectionAndSampleResultWithResponseCode("200");
-		CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(httpUrlConnection.getURL().toString());
-		setFieldInCacheEntry(cacheEntry, "etag", EXPECTED_ETAG);
-		setFieldInCacheEntry(cacheEntry, "lastModified", this.currentTimeInGMT);
-		setHeadersWithHttpUrlConnectionAndUrl();
-		Map<String, List<String>> properties = this.httpUrlConnection.getRequestProperties();
-		checkProperty(properties, HTTPConstantsInterface.IF_NONE_MATCH, EXPECTED_ETAG);
-		checkProperty(properties, HTTPConstantsInterface.IF_MODIFIED_SINCE, this.currentTimeInGMT);
-	}
-
-	public void testSetHeadersHttpURLConnectionWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
-		saveDetailsWithConnectionAndSampleResultWithResponseCode("404");
-		setHeadersWithHttpUrlConnectionAndUrl();
-		assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.url.toString()));
-	}
-
-	public void testClearCache() throws Exception {
-		assertTrue("ThreadCache should be empty initially.", getThreadCache().isEmpty());
-		saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
-		assertFalse("ThreadCache should be populated after saving details for HttpMethod with SampleResult with response code 200.", getThreadCache().isEmpty());
-		this.cacheManager.clear();
-		assertTrue("ThreadCache should be emptied by call to clear.", getThreadCache().isEmpty());
-	}
-
-	private void checkRequestHeader(String requestHeader, String expectedValue) {
-		Header header = this.httpMethod.getRequestHeader(requestHeader);
-		assertEquals("Wrong name in header for " + requestHeader, requestHeader, header.getName());
-		assertEquals("Wrong value for header " + header, expectedValue, header.getValue());
-	}
-
-	private static void checkProperty(Map<String, List<String>> properties, String property, String expectedPropertyValue) {
-		assertNotNull("Properties should not be null. Expected to find within it property = " + property + " with expected value = " + expectedPropertyValue, properties);
-		List<String> listOfPropertyValues = properties.get(property);
-		assertNotNull("No property entry found for property " + property, listOfPropertyValues);
-		assertEquals("Did not find single property for property " + property, 1, listOfPropertyValues.size());
-		assertEquals("Unexpected value for property " + property, expectedPropertyValue, listOfPropertyValues.get(0));
-	}
-
-	private SampleResult getSampleResultWithSpecifiedResponseCode(String code) {
-		SampleResult sampleResult = new SampleResult();
-		sampleResult.setResponseCode(code);
-		return sampleResult;
-	}
-
-	private Map<String, CacheManager.CacheEntry> getThreadCache() throws Exception {
-		Field threadLocalfield = CacheManager.class.getDeclaredField("threadCache");
-		threadLocalfield.setAccessible(true);
-	    @SuppressWarnings("unchecked")
-		ThreadLocal<Map<String, CacheEntry>> threadLocal = (ThreadLocal<Map<String, CacheManager.CacheEntry>>) threadLocalfield.get(this.cacheManager);
-		return threadLocal.get();
-	}
-
-	private CacheManager.CacheEntry getThreadCacheEntry(String url) throws Exception {
-		return getThreadCache().get(url);
-	}
-
-	private void saveDetailsWithHttpMethodAndSampleResultWithResponseCode(String responseCode) throws Exception {
-		SampleResult sampleResult = getSampleResultWithSpecifiedResponseCode(responseCode);
-		this.cacheManager.saveDetails(this.httpMethod, sampleResult);
-	}
-
-	private void saveDetailsWithConnectionAndSampleResultWithResponseCode(String responseCode) {
-		SampleResult sampleResult = getSampleResultWithSpecifiedResponseCode(responseCode);
-		this.cacheManager.saveDetails(this.urlConnection, sampleResult);
-	}
-
-	private void setFieldInCacheEntry(CacheManager.CacheEntry cacheEntry, String fieldName, String expectedValue) throws Exception {
-		Field field = CacheManager.CacheEntry.class.getDeclaredField(fieldName);
-		field.setAccessible(true);
-		field.set(cacheEntry, expectedValue);
-	}
-
-	private void setHeadersWithHttpUrlConnectionAndUrl() {
-		this.cacheManager.setHeaders(this.httpUrlConnection, this.url);
-	}
-
-	private void setHeadersWithUrlAndHttpMethod() {
-		this.cacheManager.setHeaders(this.url, this.httpMethod);
-	}
+        this.httpUrlConnection = null;
+        this.httpMethod = null;
+        this.urlConnection = null;
+        this.url = null;
+        this.uri = null;
+        this.cacheManager = null;
+        this.currentTimeInGMT = null;
+        super.tearDown();
+    }
+
+    public void testGetClearEachIteration() throws Exception {
+        assertFalse("Should default not to clear after each iteration.", this.cacheManager.getClearEachIteration());
+        this.cacheManager.setClearEachIteration(true);
+        assertTrue("Should be settable to clear after each iteration.", this.cacheManager.getClearEachIteration());
+        this.cacheManager.setClearEachIteration(false);
+        assertFalse("Should be settable not to clear after each iteration.", this.cacheManager.getClearEachIteration());
+    }
+
+    public void testSaveDetailsWithEmptySampleResultGivesNoCacheEntry() throws Exception {
+        saveDetailsWithConnectionAndSampleResultWithResponseCode("");
+        assertTrue("Saving details with empty SampleResult should not make cache entry.", getThreadCache().isEmpty());
+    }
+
+    public void testSaveDetailsURLConnectionWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
+        saveDetailsWithConnectionAndSampleResultWithResponseCode("200");
+        CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.url.toString());
+        assertNotNull("Saving details with SampleResult & connection with 200 response should make cache entry.", cacheEntry);
+        assertNotNull("Saving details with SampleResult & connection with 200 response should make cache entry with an etag.", cacheEntry.getEtag());
+        assertNotNull("Saving details with SampleResult & connection with 200 response should make cache entry with last modified date.", cacheEntry.getLastModified());
+    }
+
+    public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
+        saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
+        CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.httpMethod.getURI().toString());
+        assertNotNull("Saving SampleResult with HttpMethod & 200 response should make cache entry.", cacheEntry);
+        assertNull("Saving details with SampleResult & HttpMethod with 200 response should make cache entry with no etag.", cacheEntry.getEtag());
+        assertNull("Saving details with SampleResult & HttpMethod with 200 response should make cache entry with no last modified date.", cacheEntry.getLastModified());
+    }
+
+    public void testSaveDetailsURLConnectionWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
+        saveDetailsWithConnectionAndSampleResultWithResponseCode("404");
+        assertNull("Saving details with SampleResult & connection with 404 response should not make cache entry.", getThreadCacheEntry(url.toString()));
+    }
+
+    public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
+        saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
+        assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.httpMethod.getPath()));
+    }
+
+    public void testSetHeadersHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
+        this.httpMethod.setURI(this.uri);
+        this.httpMethod.addRequestHeader(new Header(HTTPConstantsInterface.IF_MODIFIED_SINCE, this.currentTimeInGMT, false));
+        this.httpMethod.addRequestHeader(new Header(HTTPConstantsInterface.ETAG, EXPECTED_ETAG, false));
+        saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
+        setFieldInCacheEntry(getThreadCacheEntry(this.httpMethod.getURI().toString()), "etag", EXPECTED_ETAG);
+        setHeadersWithUrlAndHttpMethod();
+        checkRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, EXPECTED_ETAG);
+        checkRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, this.currentTimeInGMT);
+    }
+
+    public void testSetHeadersHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
+        this.httpMethod.setURI(this.uri);
+        saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
+        setHeadersWithUrlAndHttpMethod();
+        assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.httpMethod.getPath()));
+    }
+
+    public void testSetHeadersHttpURLConnectionWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
+        saveDetailsWithConnectionAndSampleResultWithResponseCode("200");
+        CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(httpUrlConnection.getURL().toString());
+        setFieldInCacheEntry(cacheEntry, "etag", EXPECTED_ETAG);
+        setFieldInCacheEntry(cacheEntry, "lastModified", this.currentTimeInGMT);
+        setHeadersWithHttpUrlConnectionAndUrl();
+        Map<String, List<String>> properties = this.httpUrlConnection.getRequestProperties();
+        checkProperty(properties, HTTPConstantsInterface.IF_NONE_MATCH, EXPECTED_ETAG);
+        checkProperty(properties, HTTPConstantsInterface.IF_MODIFIED_SINCE, this.currentTimeInGMT);
+    }
+
+    public void testSetHeadersHttpURLConnectionWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
+        saveDetailsWithConnectionAndSampleResultWithResponseCode("404");
+        setHeadersWithHttpUrlConnectionAndUrl();
+        assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.url.toString()));
+    }
+
+    public void testClearCache() throws Exception {
+        assertTrue("ThreadCache should be empty initially.", getThreadCache().isEmpty());
+        saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
+        assertFalse("ThreadCache should be populated after saving details for HttpMethod with SampleResult with response code 200.", getThreadCache().isEmpty());
+        this.cacheManager.clear();
+        assertTrue("ThreadCache should be emptied by call to clear.", getThreadCache().isEmpty());
+    }
+
+    private void checkRequestHeader(String requestHeader, String expectedValue) {
+        Header header = this.httpMethod.getRequestHeader(requestHeader);
+        assertEquals("Wrong name in header for " + requestHeader, requestHeader, header.getName());
+        assertEquals("Wrong value for header " + header, expectedValue, header.getValue());
+    }
+
+    private static void checkProperty(Map<String, List<String>> properties, String property, String expectedPropertyValue) {
+        assertNotNull("Properties should not be null. Expected to find within it property = " + property + " with expected value = " + expectedPropertyValue, properties);
+        List<String> listOfPropertyValues = properties.get(property);
+        assertNotNull("No property entry found for property " + property, listOfPropertyValues);
+        assertEquals("Did not find single property for property " + property, 1, listOfPropertyValues.size());
+        assertEquals("Unexpected value for property " + property, expectedPropertyValue, listOfPropertyValues.get(0));
+    }
+
+    private SampleResult getSampleResultWithSpecifiedResponseCode(String code) {
+        SampleResult sampleResult = new SampleResult();
+        sampleResult.setResponseCode(code);
+        return sampleResult;
+    }
+
+    private Map<String, CacheManager.CacheEntry> getThreadCache() throws Exception {
+        Field threadLocalfield = CacheManager.class.getDeclaredField("threadCache");
+        threadLocalfield.setAccessible(true);
+        @SuppressWarnings("unchecked")
+        ThreadLocal<Map<String, CacheEntry>> threadLocal = (ThreadLocal<Map<String, CacheManager.CacheEntry>>) threadLocalfield.get(this.cacheManager);
+        return threadLocal.get();
+    }
+
+    private CacheManager.CacheEntry getThreadCacheEntry(String url) throws Exception {
+        return getThreadCache().get(url);
+    }
+
+    private void saveDetailsWithHttpMethodAndSampleResultWithResponseCode(String responseCode) throws Exception {
+        SampleResult sampleResult = getSampleResultWithSpecifiedResponseCode(responseCode);
+        this.cacheManager.saveDetails(this.httpMethod, sampleResult);
+    }
+
+    private void saveDetailsWithConnectionAndSampleResultWithResponseCode(String responseCode) {
+        SampleResult sampleResult = getSampleResultWithSpecifiedResponseCode(responseCode);
+        this.cacheManager.saveDetails(this.urlConnection, sampleResult);
+    }
+
+    private void setFieldInCacheEntry(CacheManager.CacheEntry cacheEntry, String fieldName, String expectedValue) throws Exception {
+        Field field = CacheManager.CacheEntry.class.getDeclaredField(fieldName);
+        field.setAccessible(true);
+        field.set(cacheEntry, expectedValue);
+    }
+
+    private void setHeadersWithHttpUrlConnectionAndUrl() {
+        this.cacheManager.setHeaders(this.httpUrlConnection, this.url);
+    }
+
+    private void setHeadersWithUrlAndHttpMethod() {
+        this.cacheManager.setHeaders(this.url, this.httpMethod);
+    }
 }



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