jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milam...@apache.org
Subject svn commit: r1384659 - in /jmeter/trunk/src/components/org/apache/jmeter/visualizers: RespTimeGraphDataBean.java RespTimeGraphVisualizer.java
Date Fri, 14 Sep 2012 07:01:02 GMT
Author: milamber
Date: Fri Sep 14 07:01:01 2012
New Revision: 1384659

URL: http://svn.apache.org/viewvc?rev=1384659&view=rev
Log:
The internal data list must contains sampler label to allow reload data/interval and draw
the graph if no results file defined.
Bugzilla Id: 53718

Added:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java 
 (with props)
Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java

Added: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java?rev=1384659&view=auto
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java (added)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java Fri
Sep 14 07:01:01 2012
@@ -0,0 +1,85 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ * 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jmeter.visualizers;
+
+public class RespTimeGraphDataBean {
+
+    private long startTime;
+    
+    private long time;
+    
+    private String samplerLabel;
+
+    /**
+     * @param startTime
+     * @param time
+     * @param samplerLabel
+     */
+    public RespTimeGraphDataBean(long startTime, long time, String samplerLabel) {
+        super();
+        this.startTime = startTime;
+        this.time = time;
+        this.samplerLabel = samplerLabel;
+    }
+
+    /**
+     * @return the startTime
+     */
+    public long getStartTime() {
+        return startTime;
+    }
+
+    /**
+     * @param startTime the startTime to set
+     */
+    public void setStartTime(long startTime) {
+        this.startTime = startTime;
+    }
+
+    /**
+     * @return the time
+     */
+    public long getTime() {
+        return time;
+    }
+
+    /**
+     * @param time the time to set
+     */
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    /**
+     * @return the samplerLabel
+     */
+    public String getSamplerLabel() {
+        return samplerLabel;
+    }
+
+    /**
+     * @param samplerLabel the samplerLabel to set
+     */
+    public void setSamplerLabel(String samplerLabel) {
+        this.samplerLabel = samplerLabel;
+    }
+    
+    
+}

Propchange: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphDataBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java?rev=1384659&r1=1384658&r2=1384659&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
Fri Sep 14 07:01:01 2012
@@ -32,8 +32,6 @@ import java.awt.event.ActionListener;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -195,8 +193,7 @@ public class RespTimeGraphVisualizer ext
 
     private final List<Color> listColors = Colors.getColors();
 
-    // Use implementation instead of Interface as we need it to be cloneable
-    private final HashMap<Long, Long> internalMap = new HashMap<Long, Long>();
// internal list of all results
+    private final List<RespTimeGraphDataBean> internalList = new ArrayList<RespTimeGraphDataBean>();
// internal list of all results
 
     public RespTimeGraphVisualizer() {
         init();
@@ -206,7 +203,7 @@ public class RespTimeGraphVisualizer ext
         final String sampleLabel = sampleResult.getSampleLabel();
         // Make a internal list of all results to allow reload data with filter or interval
         synchronized (lockInterval) {
-            internalMap.put(Long.valueOf(sampleResult.getStartTime()), Long.valueOf(sampleResult.getTime()));
+            internalList.add(new RespTimeGraphDataBean(sampleResult.getStartTime(), sampleResult.getTime(),
sampleLabel));
         }
 
         // Sampler selection
@@ -355,7 +352,7 @@ public class RespTimeGraphVisualizer ext
 
     public void clearData() {
         synchronized (lock) {
-            internalMap.clear();
+            internalList.clear();
             seriesNames.clear();
             pList.clear();
             minStartTime = Integer.MAX_VALUE;
@@ -476,15 +473,15 @@ public class RespTimeGraphVisualizer ext
                 filePanel.actionPerformed(event);
             } else {
                 // Reload data form internal list of results
-                if (internalMap.size() >= 2) {
+                if (internalList.size() >= 2) {
                     synchronized (lockInterval) {
-                        @SuppressWarnings("unchecked")
-                        HashMap<Long, Long> tempMap = (HashMap<Long, Long>) internalMap.clone();
+                        List<RespTimeGraphDataBean> tempList = new ArrayList<RespTimeGraphDataBean>();
+                        tempList.addAll(internalList);
                         this.clearData();
-                        for (Iterator<Map.Entry<Long, Long>> iterator = tempMap.entrySet().iterator();
iterator
-                                .hasNext();) {
-                            Map.Entry<Long, Long> entry = iterator.next();
-                            this.add(new SampleResult(entry.getKey().longValue(), entry.getValue().longValue()));
+                        for (RespTimeGraphDataBean data : tempList) {
+                            SampleResult sr = new SampleResult(data.getStartTime(), data.getTime());
+                            sr.setSampleLabel(data.getSamplerLabel());
+                            this.add(sr);
                         }
                     }
                 }



Mime
View raw message