001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018: package org.apache.jmeter.testelement;
019:
020: import java.util.List;
021:
022: import org.apache.jmeter.report.ReportTable;
023: import org.apache.jorphan.logging.LoggingManager;
024: import org.apache.log.Logger;
025:
026: /**
027: * AbstractTable is the base Element for different kinds of report tables.
028: * @author pete
029: *
030: */
031: public abstract class AbstractTable extends AbstractTestElement
032: implements ReportTable {
033:
034: private static final Logger log = LoggingManager
035: .getLoggerForClass();
036:
037: public static final String REPORT_TABLE_MEAN = "ReportTable.Mean";
038: public static final String REPORT_TABLE_MEDIAN = "ReportTable.Median";
039: public static final String REPORT_TABLE_MAX = "ReportTable.Max";
040: public static final String REPORT_TABLE_MIN = "ReportTable.Min";
041: public static final String REPORT_TABLE_RESPONSE_RATE = "ReportTable.Response_rate";
042: public static final String REPORT_TABLE_TRANSFER_RATE = "ReportTable.Transfer_rate";
043: public static final String REPORT_TABLE_50_PERCENT = "ReportTable.50_percent";
044: public static final String REPORT_TABLE_90_PERCENT = "ReportTable.90_percent";
045: public static final String REPORT_TABLE_ERROR_RATE = "ReportTable.Error.rate";
046: public static final String[] items = { REPORT_TABLE_MEAN,
047: REPORT_TABLE_MEDIAN, REPORT_TABLE_MAX, REPORT_TABLE_MIN,
048: REPORT_TABLE_RESPONSE_RATE, REPORT_TABLE_TRANSFER_RATE,
049: REPORT_TABLE_50_PERCENT, REPORT_TABLE_90_PERCENT,
050: REPORT_TABLE_ERROR_RATE };
051:
052: public static final String REPORT_TABLE_TOTAL = "ReportTable.total";
053: public static final String REPORT_TABLE_URL = "ReportTable.url";
054:
055: public static final String[] xitems = { REPORT_TABLE_TOTAL,
056: REPORT_TABLE_URL };
057:
058: public AbstractTable() {
059: super ();
060: }
061:
062: public boolean getMean() {
063: return getPropertyAsBoolean(REPORT_TABLE_MEAN);
064: }
065:
066: public void setMean(String set) {
067: setProperty(REPORT_TABLE_MEAN, set);
068: }
069:
070: public boolean getMedian() {
071: return getPropertyAsBoolean(REPORT_TABLE_MEDIAN);
072: }
073:
074: public void setMedian(String set) {
075: setProperty(REPORT_TABLE_MEDIAN, set);
076: }
077:
078: public boolean getMax() {
079: return getPropertyAsBoolean(REPORT_TABLE_MAX);
080: }
081:
082: public void setMax(String set) {
083: setProperty(REPORT_TABLE_MAX, set);
084: }
085:
086: public boolean getMin() {
087: return getPropertyAsBoolean(REPORT_TABLE_MIN);
088: }
089:
090: public void setMin(String set) {
091: setProperty(REPORT_TABLE_MIN, set);
092: }
093:
094: public boolean getResponseRate() {
095: return getPropertyAsBoolean(REPORT_TABLE_RESPONSE_RATE);
096: }
097:
098: public void setResponseRate(String set) {
099: setProperty(REPORT_TABLE_RESPONSE_RATE, set);
100: }
101:
102: public boolean getTransferRate() {
103: return getPropertyAsBoolean(REPORT_TABLE_TRANSFER_RATE);
104: }
105:
106: public void setTransferRate(String set) {
107: setProperty(REPORT_TABLE_TRANSFER_RATE, set);
108: }
109:
110: public boolean get50Percent() {
111: return getPropertyAsBoolean(REPORT_TABLE_50_PERCENT);
112: }
113:
114: public void set50Percent(String set) {
115: setProperty(REPORT_TABLE_50_PERCENT, set);
116: }
117:
118: public boolean get90Percent() {
119: return getPropertyAsBoolean(REPORT_TABLE_90_PERCENT);
120: }
121:
122: public void set90Percent(String set) {
123: setProperty(REPORT_TABLE_90_PERCENT, set);
124: }
125:
126: public boolean getErrorRate() {
127: return getPropertyAsBoolean(REPORT_TABLE_ERROR_RATE);
128: }
129:
130: public void setErrorRate(String set) {
131: setProperty(REPORT_TABLE_ERROR_RATE, set);
132: }
133:
134: public void addTestElement(TestElement el) {
135: if (el != null) {
136: super .addTestElement(el);
137: log.info("TestElement: " + el.getClass().getName());
138: }
139: }
140:
141: /**
142: * method isn't implemented and is left abstract. Subclasses
143: * need to filter the data in the list and return statistics.
144: * The statistics should be like the aggregate listener.
145: */
146: public abstract String[][] getTableData(List data);
147:
148: }
|