From commits-return-4397-apmail-jmeter-commits-archive=jmeter.apache.org@jmeter.apache.org Thu Dec 10 19:10:24 2015 Return-Path: X-Original-To: apmail-jmeter-commits-archive@minotaur.apache.org Delivered-To: apmail-jmeter-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E90281863D for ; Thu, 10 Dec 2015 19:10:24 +0000 (UTC) Received: (qmail 55604 invoked by uid 500); 10 Dec 2015 19:10:24 -0000 Delivered-To: apmail-jmeter-commits-archive@jmeter.apache.org Received: (qmail 55576 invoked by uid 500); 10 Dec 2015 19:10:24 -0000 Mailing-List: contact commits-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list commits@jmeter.apache.org Received: (qmail 55567 invoked by uid 99); 10 Dec 2015 19:10:24 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Dec 2015 19:10:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id E66B3C128A for ; Thu, 10 Dec 2015 19:10:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.247 X-Spam-Level: * X-Spam-Status: No, score=1.247 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id LWJCw41LJYIy for ; Thu, 10 Dec 2015 19:10:10 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id DFC00429C7 for ; Thu, 10 Dec 2015 19:10:09 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 314AEE0EDD for ; Thu, 10 Dec 2015 19:10:09 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 29C003A04EC for ; Thu, 10 Dec 2015 19:10:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1719185 [3/8] - in /jmeter/trunk/src/core/org/apache/jmeter/report: config/ core/ dashboard/ processor/ processor/graph/ processor/graph/impl/ Date: Thu, 10 Dec 2015 19:10:08 -0000 To: commits@jmeter.apache.org From: fschumacher@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151210191009.29C003A04EC@svn01-us-west.apache.org> Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/AbstractDataExporter.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/AbstractDataExporter.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/AbstractDataExporter.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/AbstractDataExporter.java Thu Dec 10 19:10:06 2015 @@ -1,54 +1,54 @@ -/* - * 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.report.dashboard; - -/** - * The Class AbstractDataExporter provides a base class for DataExporter. - */ -public abstract class AbstractDataExporter implements DataExporter { - - private String name; - - /** - * Instantiates a new abstract data exporter. - */ - protected AbstractDataExporter() { - } - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.dashboard.DataExporter#getName() - */ - @Override - public String getName() { - return name; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.dashboard.DataExporter#setName(java.lang.String) - */ - @Override - public void setName(String name) { - this.name = name; - } - -} +/* + * 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.report.dashboard; + +/** + * The Class AbstractDataExporter provides a base class for DataExporter. + */ +public abstract class AbstractDataExporter implements DataExporter { + + private String name; + + /** + * Instantiates a new abstract data exporter. + */ + protected AbstractDataExporter() { + } + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.dashboard.DataExporter#getName() + */ + @Override + public String getName() { + return name; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.dashboard.DataExporter#setName(java.lang.String) + */ + @Override + public void setName(String name) { + this.name = name; + } + +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/AbstractDataExporter.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/DataExporter.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/DataExporter.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/DataExporter.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/DataExporter.java Thu Dec 10 19:10:06 2015 @@ -1,62 +1,62 @@ -/* - * 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.report.dashboard; - -import java.io.File; - -import org.apache.jmeter.report.config.ReportGeneratorConfiguration; -import org.apache.jmeter.report.processor.SampleContext; - -/** - * The Interface DataExporter represents an engine to export data from samples - * consumption. - * - * @since 2.14 - */ -public interface DataExporter { - - /** - * Gets the name of the exporter. - * - * @return the name of the exporter - */ - String getName(); - - /** - * Sets the name of the exporter. - * - * @param name - * the new name of the exporter - */ - void setName(String name); - - /** - * Export data from the specified context using the given configuration. - * - * @param context - * the context - * @param file - * the file which from samples come - * @param configuration - * the configuration - * @throws ExportException - * the export exception - */ - void export(SampleContext context, File file, - ReportGeneratorConfiguration configuration) throws ExportException; -} +/* + * 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.report.dashboard; + +import java.io.File; + +import org.apache.jmeter.report.config.ReportGeneratorConfiguration; +import org.apache.jmeter.report.processor.SampleContext; + +/** + * The Interface DataExporter represents an engine to export data from samples + * consumption. + * + * @since 2.14 + */ +public interface DataExporter { + + /** + * Gets the name of the exporter. + * + * @return the name of the exporter + */ + String getName(); + + /** + * Sets the name of the exporter. + * + * @param name + * the new name of the exporter + */ + void setName(String name); + + /** + * Export data from the specified context using the given configuration. + * + * @param context + * the context + * @param file + * the file which from samples come + * @param configuration + * the configuration + * @throws ExportException + * the export exception + */ + void export(SampleContext context, File file, + ReportGeneratorConfiguration configuration) throws ExportException; +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/DataExporter.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ExportException.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ExportException.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ExportException.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ExportException.java Thu Dec 10 19:10:06 2015 @@ -1,59 +1,59 @@ -/* - * 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.report.dashboard; - -/** - * The class ExportException provides an exception when data export fails. - * - * @since 2.14 - */ -public class ExportException extends Exception { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 89868452883024813L; - - /** - * Instantiates a new export exception. - */ - public ExportException() { - super(); - } - - /** - * Instantiates a new export exception. - * - * @param message - * the message - */ - public ExportException(String message) { - super(message); - } - - /** - * Instantiates a new export exception. - * - * @param message - * the message - * @param cause - * the inner cause - */ - public ExportException(String message, Throwable cause) { - super(message, cause); - } - -} +/* + * 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.report.dashboard; + +/** + * The class ExportException provides an exception when data export fails. + * + * @since 2.14 + */ +public class ExportException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 89868452883024813L; + + /** + * Instantiates a new export exception. + */ + public ExportException() { + super(); + } + + /** + * Instantiates a new export exception. + * + * @param message + * the message + */ + public ExportException(String message) { + super(message); + } + + /** + * Instantiates a new export exception. + * + * @param message + * the message + * @param cause + * the inner cause + */ + public ExportException(String message, Throwable cause) { + super(message, cause); + } + +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ExportException.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/GenerationException.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/GenerationException.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/GenerationException.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/GenerationException.java Thu Dec 10 19:10:06 2015 @@ -1,60 +1,60 @@ -/* - * 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.report.dashboard; - -/** - * The class GenerationException provides an exception when report generation - * fails. - * - * @since 2.14 - */ -public class GenerationException extends Exception { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = 8344451600520488094L; - - /** - * Instantiates a new configuration exception. - */ - public GenerationException() { - super(); - } - - /** - * Instantiates a new configuration exception. - * - * @param message - * the message - */ - public GenerationException(String message) { - super(message); - } - - /** - * Instantiates a new configuration exception. - * - * @param message - * the message - * @param cause - * the cause - */ - public GenerationException(String message, Throwable cause) { - super(message, cause); - } - -} +/* + * 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.report.dashboard; + +/** + * The class GenerationException provides an exception when report generation + * fails. + * + * @since 2.14 + */ +public class GenerationException extends Exception { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 8344451600520488094L; + + /** + * Instantiates a new configuration exception. + */ + public GenerationException() { + super(); + } + + /** + * Instantiates a new configuration exception. + * + * @param message + * the message + */ + public GenerationException(String message) { + super(message); + } + + /** + * Instantiates a new configuration exception. + * + * @param message + * the message + * @param cause + * the cause + */ + public GenerationException(String message, Throwable cause) { + super(message, cause); + } + +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/GenerationException.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/HtmlTemplateExporter.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/JsonizerVisitor.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/JsonizerVisitor.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/JsonizerVisitor.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/JsonizerVisitor.java Thu Dec 10 19:10:06 2015 @@ -1,105 +1,105 @@ -/* - * 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.report.dashboard; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.jmeter.report.core.JsonUtil; -import org.apache.jmeter.report.processor.ListResultData; -import org.apache.jmeter.report.processor.MapResultData; -import org.apache.jmeter.report.processor.ResultData; -import org.apache.jmeter.report.processor.ResultDataVisitor; -import org.apache.jmeter.report.processor.ValueResultData; - -/** - * The class JsonizerVisitor provides a visitor that can get json-like string - * from ResultData. - * - * @since 2.14 - */ -public class JsonizerVisitor implements ResultDataVisitor { - - /** - * Instantiates a new jsonizer visitor. - */ - public JsonizerVisitor() { - // TODO Auto-generated constructor stub - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.ResultDataVisitor#visitListResult( - * org.apache.jmeter.report.processor.ListResultData) - */ - @Override - public String visitListResult(ListResultData listResult) { - String result = ""; - if (listResult != null) { - int count = listResult.getSize(); - String[] items = new String[count]; - for (int i = 0; i < count; i++) { - items[i] = listResult.get(i).accept(this); - } - result = JsonUtil.toJsonArray(items); - } - return result; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.ResultDataVisitor#visitMapResult(org - * .apache.jmeter.report.processor.MapResultData) - */ - @Override - public String visitMapResult(MapResultData mapResult) { - String result = ""; - if (mapResult != null) { - HashMap map = new HashMap<>(); - for (Map.Entry entry : mapResult.entrySet()) { - map.put(entry.getKey(), entry.getValue().accept(this)); - } - result = JsonUtil.toJsonObject(map); - } - return result; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.ResultDataVisitor#visitValueResult - * (org.apache.jmeter.report.processor.ValueResultData) - */ - @Override - public String visitValueResult(ValueResultData valueResult) { - String result = ""; - if (valueResult != null) { - Object value = valueResult.getValue(); - result = String.valueOf(value); - if (value instanceof String) { - result = '"' + result + '"'; - } - } - return result; - } -} +/* + * 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.report.dashboard; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jmeter.report.core.JsonUtil; +import org.apache.jmeter.report.processor.ListResultData; +import org.apache.jmeter.report.processor.MapResultData; +import org.apache.jmeter.report.processor.ResultData; +import org.apache.jmeter.report.processor.ResultDataVisitor; +import org.apache.jmeter.report.processor.ValueResultData; + +/** + * The class JsonizerVisitor provides a visitor that can get json-like string + * from ResultData. + * + * @since 2.14 + */ +public class JsonizerVisitor implements ResultDataVisitor { + + /** + * Instantiates a new jsonizer visitor. + */ + public JsonizerVisitor() { + // TODO Auto-generated constructor stub + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.ResultDataVisitor#visitListResult( + * org.apache.jmeter.report.processor.ListResultData) + */ + @Override + public String visitListResult(ListResultData listResult) { + String result = ""; + if (listResult != null) { + int count = listResult.getSize(); + String[] items = new String[count]; + for (int i = 0; i < count; i++) { + items[i] = listResult.get(i).accept(this); + } + result = JsonUtil.toJsonArray(items); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.ResultDataVisitor#visitMapResult(org + * .apache.jmeter.report.processor.MapResultData) + */ + @Override + public String visitMapResult(MapResultData mapResult) { + String result = ""; + if (mapResult != null) { + HashMap map = new HashMap<>(); + for (Map.Entry entry : mapResult.entrySet()) { + map.put(entry.getKey(), entry.getValue().accept(this)); + } + result = JsonUtil.toJsonObject(map); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.ResultDataVisitor#visitValueResult + * (org.apache.jmeter.report.processor.ValueResultData) + */ + @Override + public String visitValueResult(ValueResultData valueResult) { + String result = ""; + if (valueResult != null) { + Object value = valueResult.getValue(); + result = String.valueOf(value); + if (value instanceof String) { + result = '"' + result + '"'; + } + } + return result; + } +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/JsonizerVisitor.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/TemplateVisitor.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/TemplateVisitor.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/TemplateVisitor.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/TemplateVisitor.java Thu Dec 10 19:10:06 2015 @@ -1,128 +1,128 @@ -/* - * 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.report.dashboard; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.nio.file.StandardCopyOption; -import java.nio.file.FileAlreadyExistsException; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; -import org.apache.jmeter.report.core.DataContext; - -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; - -/** - * The class TemplateVisitor visits files in a template directory to copy - * regular files and process templated ones. - * - * @since 2.14 - */ -public class TemplateVisitor extends SimpleFileVisitor { - - public static final String TEMPLATED_FILE_EXT = "fmkr"; - - private final Path source; - private final Path target; - private final Configuration configuration; - private final DataContext data; - - /** - * Instantiates a new template visitor. - * - * @param source - * the source directory - * @param target - * the target directory - * @param configuration - * the freemarker configuration - * @param data - * the data to inject - */ - public TemplateVisitor(Path source, Path target, - Configuration configuration, DataContext data) { - this.source = source; - this.target = target; - this.configuration = configuration; - this.data = data; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.SimpleFileVisitor#preVisitDirectory(java.lang.Object, - * java.nio.file.attribute.BasicFileAttributes) - */ - @Override - public FileVisitResult preVisitDirectory(Path arg0, BasicFileAttributes arg1) - throws IOException { - // Copy directory - Path newDir = target.resolve(source.relativize(arg0)); - try { - Files.copy(arg0, newDir); - } catch (FileAlreadyExistsException ex) { - // Set directory empty - FileUtils.cleanDirectory(newDir.toFile()); - } - return FileVisitResult.CONTINUE; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.SimpleFileVisitor#visitFile(java.lang.Object, - * java.nio.file.attribute.BasicFileAttributes) - */ - @Override - public FileVisitResult visitFile(Path arg0, BasicFileAttributes arg1) - throws IOException { - - // Depending on file extension, copy or process file - String extension = FilenameUtils.getExtension(arg0.toString()); - if (TEMPLATED_FILE_EXT.equalsIgnoreCase(extension)) { - // Process template file - String templatePath = source.relativize(arg0).toString(); - Template template = configuration.getTemplate(templatePath); - Path newPath = target.resolve(FilenameUtils - .removeExtension(templatePath)); - Writer file = new FileWriter(newPath.toString()); - try { - template.process(data, file); - } catch (TemplateException ex) { - throw new IOException(ex); - } finally { - file.close(); - } - - } else { - // Copy regular file - Path newFile = target.resolve(source.relativize(arg0)); - Files.copy(arg0, newFile, StandardCopyOption.REPLACE_EXISTING); - } - return FileVisitResult.CONTINUE; - } -} +/* + * 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.report.dashboard; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.StandardCopyOption; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.jmeter.report.core.DataContext; + +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; + +/** + * The class TemplateVisitor visits files in a template directory to copy + * regular files and process templated ones. + * + * @since 2.14 + */ +public class TemplateVisitor extends SimpleFileVisitor { + + public static final String TEMPLATED_FILE_EXT = "fmkr"; + + private final Path source; + private final Path target; + private final Configuration configuration; + private final DataContext data; + + /** + * Instantiates a new template visitor. + * + * @param source + * the source directory + * @param target + * the target directory + * @param configuration + * the freemarker configuration + * @param data + * the data to inject + */ + public TemplateVisitor(Path source, Path target, + Configuration configuration, DataContext data) { + this.source = source; + this.target = target; + this.configuration = configuration; + this.data = data; + } + + /* + * (non-Javadoc) + * + * @see java.nio.file.SimpleFileVisitor#preVisitDirectory(java.lang.Object, + * java.nio.file.attribute.BasicFileAttributes) + */ + @Override + public FileVisitResult preVisitDirectory(Path arg0, BasicFileAttributes arg1) + throws IOException { + // Copy directory + Path newDir = target.resolve(source.relativize(arg0)); + try { + Files.copy(arg0, newDir); + } catch (FileAlreadyExistsException ex) { + // Set directory empty + FileUtils.cleanDirectory(newDir.toFile()); + } + return FileVisitResult.CONTINUE; + } + + /* + * (non-Javadoc) + * + * @see java.nio.file.SimpleFileVisitor#visitFile(java.lang.Object, + * java.nio.file.attribute.BasicFileAttributes) + */ + @Override + public FileVisitResult visitFile(Path arg0, BasicFileAttributes arg1) + throws IOException { + + // Depending on file extension, copy or process file + String extension = FilenameUtils.getExtension(arg0.toString()); + if (TEMPLATED_FILE_EXT.equalsIgnoreCase(extension)) { + // Process template file + String templatePath = source.relativize(arg0).toString(); + Template template = configuration.getTemplate(templatePath); + Path newPath = target.resolve(FilenameUtils + .removeExtension(templatePath)); + Writer file = new FileWriter(newPath.toString()); + try { + template.process(data, file); + } catch (TemplateException ex) { + throw new IOException(ex); + } finally { + file.close(); + } + + } else { + // Copy regular file + Path newFile = target.resolve(source.relativize(arg0)); + Files.copy(arg0, newFile, StandardCopyOption.REPLACE_EXISTING); + } + return FileVisitResult.CONTINUE; + } +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/TemplateVisitor.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractAggregatorFactory.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractAggregatorFactory.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractAggregatorFactory.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractAggregatorFactory.java Thu Dec 10 19:10:06 2015 @@ -1,76 +1,76 @@ -/* - * 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.report.processor; - -/** - *

- * A factory for creating AbstractAggregator objects. - *

- * - *

- * This abstract class creates the same kind of aggregator for each create - * method. - *

- * - * @since 2.14 - */ -public abstract class AbstractAggregatorFactory implements AggregatorFactory { - - /** - * Instantiates a new abstract aggregator factory. - */ - protected AbstractAggregatorFactory() { - } - - protected abstract Aggregator createAggregator(); - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.core.GraphAggregatorFactory# - * createValueAggregator(double) - */ - @Override - public final Aggregator createValueAggregator() { - return createAggregator(); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.core.GraphAggregatorFactory#createKeyAggregator - * () - */ - @Override - public final Aggregator createKeyAggregator() { - return createAggregator(); - } - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.core.GraphAggregatorFactory# - * createAggregatedKeyValueAggregator() - */ - @Override - public final Aggregator createAggregatedKeyValueAggregator() { - return createAggregator(); - } - -} +/* + * 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.report.processor; + +/** + *

+ * A factory for creating AbstractAggregator objects. + *

+ * + *

+ * This abstract class creates the same kind of aggregator for each create + * method. + *

+ * + * @since 2.14 + */ +public abstract class AbstractAggregatorFactory implements AggregatorFactory { + + /** + * Instantiates a new abstract aggregator factory. + */ + protected AbstractAggregatorFactory() { + } + + protected abstract Aggregator createAggregator(); + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.core.GraphAggregatorFactory# + * createValueAggregator(double) + */ + @Override + public final Aggregator createValueAggregator() { + return createAggregator(); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.core.GraphAggregatorFactory#createKeyAggregator + * () + */ + @Override + public final Aggregator createKeyAggregator() { + return createAggregator(); + } + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.core.GraphAggregatorFactory# + * createAggregatedKeyValueAggregator() + */ + @Override + public final Aggregator createAggregatedKeyValueAggregator() { + return createAggregator(); + } + +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractAggregatorFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleConsumer.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleProcessor.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleSource.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleSource.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleSource.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleSource.java Thu Dec 10 19:10:06 2015 @@ -1,97 +1,97 @@ -/* - * 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.report.processor; - -import java.util.List; - -/** - * @author Ubik - * - */ -public abstract class AbstractSampleSource implements SampleSource { - - private SampleContext sampleContext; - - /** - * Instantiates a new abstract sample source. - */ - protected AbstractSampleSource() { - // TODO Auto-generated constructor stub - } - - /* - * (non-Javadoc) - * - * @see java.lang.Runnable#run() - */ - @Override - public abstract void run(); - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.processor.SampleSource#getSampleContext() - */ - @Override - public SampleContext getSampleContext() { - return sampleContext; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.SampleSource#setSampleContext(org. - * apache.jmeter.report.processor.SampleContext) - */ - @Override - public void setSampleContext(SampleContext sampleContext) { - this.sampleContext = sampleContext; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.SampleSource#addSampleConsumers(java - * .util.List) - */ - @Override - public abstract void setSampleConsumers(List consumers); - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.SampleSource#addSampleConsumer(org - * .apache.jmeter.report.processor.SampleConsumer) - */ - @Override - public abstract void addSampleConsumer(SampleConsumer consumer); - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.SampleSource#removeSampleConsumer( - * org.apache.jmeter.report.processor.SampleConsumer) - */ - @Override - public abstract void removeSampleConsumer(SampleConsumer consumer); - -} +/* + * 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.report.processor; + +import java.util.List; + +/** + * @author Ubik + * + */ +public abstract class AbstractSampleSource implements SampleSource { + + private SampleContext sampleContext; + + /** + * Instantiates a new abstract sample source. + */ + protected AbstractSampleSource() { + // TODO Auto-generated constructor stub + } + + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + @Override + public abstract void run(); + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.processor.SampleSource#getSampleContext() + */ + @Override + public SampleContext getSampleContext() { + return sampleContext; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.SampleSource#setSampleContext(org. + * apache.jmeter.report.processor.SampleContext) + */ + @Override + public void setSampleContext(SampleContext sampleContext) { + this.sampleContext = sampleContext; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.SampleSource#addSampleConsumers(java + * .util.List) + */ + @Override + public abstract void setSampleConsumers(List consumers); + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.SampleSource#addSampleConsumer(org + * .apache.jmeter.report.processor.SampleConsumer) + */ + @Override + public abstract void addSampleConsumer(SampleConsumer consumer); + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.SampleSource#removeSampleConsumer( + * org.apache.jmeter.report.processor.SampleConsumer) + */ + @Override + public abstract void removeSampleConsumer(SampleConsumer consumer); + +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSampleSource.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSummaryConsumer.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSummaryConsumer.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSummaryConsumer.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSummaryConsumer.java Thu Dec 10 19:10:06 2015 @@ -1,286 +1,286 @@ -/* - * 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.report.processor; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.jmeter.report.core.Sample; - -/** - * The class AbstractSummaryConsumer provides a base class for data of the - * dashboard page. - * - * @param - * the type of data to process - * @since 2.14 - */ -public abstract class AbstractSummaryConsumer extends - AbstractSampleConsumer { - - /** - * The class SummaryInfo stores intermediate results. - */ - protected class SummaryInfo { - final boolean isController; - TData data; - - /** - * Checks if these information implies controller sample. - * - * @return true, if is controller - */ - public final boolean isController() { - return isController; - } - - /** - * Gets the data to store. - * - * @return the data to store - */ - public final TData getData() { - return data; - } - - /** - * Sets the data to store. - * - * @param data - * the new data to store - */ - public final void setData(TData data) { - this.data = data; - } - - /** - * Instantiates a new summary info. - * - * @param isController - * true, if these information implies only controller - * samples; false otherwise - */ - public SummaryInfo(boolean isController) { - this.isController = isController; - } - - } - - public static final String RESULT_VALUE_DATA = "data"; - public static final String RESULT_VALUE_IS_CONTROLLER = "isController"; - public static final String RESULT_VALUE_ITEMS = "items"; - public static final String RESULT_VALUE_OVERALL = "overall"; - public static final String RESULT_VALUE_SUPPORTS_CONTROLLERS_DISCRIMINATION = "supportsControllersDiscrimination"; - public static final String RESULT_VALUE_TITLES = "titles"; - - private final Map infos = new HashMap<>(); - private final SummaryInfo overallInfo = new SummaryInfo(false); - private final boolean supportsControllersDiscrimination; - - private boolean hasOverallResult; - - /** - * Defines whether the result contains an overall item. - * - * @return true, if the result contains an overall item - */ - public final boolean hasOverallResult() { - return hasOverallResult; - } - - /** - * Defines whether the result contains an overall item. - * - * @param hasOverallResult - * true, if the result contains an overall item; false otherwise - */ - public final void setHasOverallResult(boolean hasOverallResult) { - this.hasOverallResult = hasOverallResult; - } - - /** - * Indicates whether this summary can discriminate controller samples - * - * @return true, if this summary can discriminate controller samples; false - * otherwise. - */ - public final boolean suppportsControllersDiscrimination() { - return supportsControllersDiscrimination; - } - - /** - * Gets the overall info. - * - * @return the overall info - */ - protected final SummaryInfo getOverallInfo() { - return overallInfo; - } - - /** - * Gets the summary infos. - * - * @return the summary infos - */ - protected final Map getSummaryInfos() { - return infos; - } - - /** - * Instantiates a new abstract summary consumer. - * - * @param supportsControllersDiscrimination - * indicates whether this summary can discriminate controller - * samples - */ - protected AbstractSummaryConsumer(boolean supportsControllersDiscrimination) { - this.supportsControllersDiscrimination = supportsControllersDiscrimination; - } - - /** - * Gets the identifier key from sample.
- * This key is use identify the SummaryInfo linked with the sample - * - * @param sample - * the sample - * @return the key identifying the sample - */ - protected abstract String getKeyFromSample(Sample sample); - - /** - * Creates a result item for information identified by the specified key.
- * - * @param key - * the key - * @param data - * the data - * @return the list result data - */ - protected abstract ListResultData createDataResult(String key, TData data); - - /** - * Creates the result containing titles of columns. - * - * @return the list of titles - */ - protected abstract ListResultData createResultTitles(); - - /** - * Update the stored data with the data from the specified sample. - * - * @param sample - * the sample - */ - protected abstract void updateData(SummaryInfo info, Sample sample); - - private MapResultData createResultFromKey(String key) { - SummaryInfo info = (key == null) ? overallInfo : infos.get(key); - MapResultData result = null; - TData data = info.getData(); - if (data != null) { - result = new MapResultData(); - result.setResult(RESULT_VALUE_IS_CONTROLLER, new ValueResultData( - info.isController())); - result.setResult(RESULT_VALUE_DATA, createDataResult(key, data)); - } - return result; - } - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.processor.SampleConsumer#startConsuming() - */ - @Override - public void startConsuming() { - - // Broadcast metadata to consumes for each channel - int channelCount = getConsumedChannelCount(); - for (int i = 0; i < channelCount; i++) { - super.setProducedMetadata(getConsumedMetadata(i), i); - } - super.startProducing(); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.SampleConsumer#consume(org.apache. - * jmeter.report.core.Sample, int) - */ - @Override - public void consume(Sample sample, int channel) { - String key = getKeyFromSample(sample); - - // Get the object to store counters or create it if it does not exist. - SummaryInfo info = infos.get(key); - if (info == null) { - info = new SummaryInfo(supportsControllersDiscrimination - && sample.isController()); - infos.put(key, info); - } - updateData(info, sample); - super.produce(sample, channel); - } - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.processor.SampleConsumer#stopConsuming() - */ - @Override - public void stopConsuming() { - MapResultData result = new MapResultData(); - - // Push the support flag in the result - result.setResult(RESULT_VALUE_SUPPORTS_CONTROLLERS_DISCRIMINATION, - new ValueResultData(supportsControllersDiscrimination)); - - // Add headers - result.setResult(RESULT_VALUE_TITLES, createResultTitles()); - - // Add overall row if needed - if (hasOverallResult) { - MapResultData overallResult = createResultFromKey(null); - if (overallResult != null) { - result.setResult(RESULT_VALUE_OVERALL, overallResult); - } - } - - // Build rows from samples - ListResultData itemsResult = new ListResultData(); - for (String key : infos.keySet()) { - // Add result only if data exist - MapResultData keyResult = createResultFromKey(key); - if (keyResult != null) { - itemsResult.addResult(keyResult); - } - } - result.setResult(RESULT_VALUE_ITEMS, itemsResult); - - // Store the result in the context - setDataToContext(getName(), result); - - super.stopProducing(); - - // Reset infos - infos.clear(); - overallInfo.setData(null); - } -} +/* + * 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.report.processor; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jmeter.report.core.Sample; + +/** + * The class AbstractSummaryConsumer provides a base class for data of the + * dashboard page. + * + * @param + * the type of data to process + * @since 2.14 + */ +public abstract class AbstractSummaryConsumer extends + AbstractSampleConsumer { + + /** + * The class SummaryInfo stores intermediate results. + */ + protected class SummaryInfo { + final boolean isController; + TData data; + + /** + * Checks if these information implies controller sample. + * + * @return true, if is controller + */ + public final boolean isController() { + return isController; + } + + /** + * Gets the data to store. + * + * @return the data to store + */ + public final TData getData() { + return data; + } + + /** + * Sets the data to store. + * + * @param data + * the new data to store + */ + public final void setData(TData data) { + this.data = data; + } + + /** + * Instantiates a new summary info. + * + * @param isController + * true, if these information implies only controller + * samples; false otherwise + */ + public SummaryInfo(boolean isController) { + this.isController = isController; + } + + } + + public static final String RESULT_VALUE_DATA = "data"; + public static final String RESULT_VALUE_IS_CONTROLLER = "isController"; + public static final String RESULT_VALUE_ITEMS = "items"; + public static final String RESULT_VALUE_OVERALL = "overall"; + public static final String RESULT_VALUE_SUPPORTS_CONTROLLERS_DISCRIMINATION = "supportsControllersDiscrimination"; + public static final String RESULT_VALUE_TITLES = "titles"; + + private final Map infos = new HashMap<>(); + private final SummaryInfo overallInfo = new SummaryInfo(false); + private final boolean supportsControllersDiscrimination; + + private boolean hasOverallResult; + + /** + * Defines whether the result contains an overall item. + * + * @return true, if the result contains an overall item + */ + public final boolean hasOverallResult() { + return hasOverallResult; + } + + /** + * Defines whether the result contains an overall item. + * + * @param hasOverallResult + * true, if the result contains an overall item; false otherwise + */ + public final void setHasOverallResult(boolean hasOverallResult) { + this.hasOverallResult = hasOverallResult; + } + + /** + * Indicates whether this summary can discriminate controller samples + * + * @return true, if this summary can discriminate controller samples; false + * otherwise. + */ + public final boolean suppportsControllersDiscrimination() { + return supportsControllersDiscrimination; + } + + /** + * Gets the overall info. + * + * @return the overall info + */ + protected final SummaryInfo getOverallInfo() { + return overallInfo; + } + + /** + * Gets the summary infos. + * + * @return the summary infos + */ + protected final Map getSummaryInfos() { + return infos; + } + + /** + * Instantiates a new abstract summary consumer. + * + * @param supportsControllersDiscrimination + * indicates whether this summary can discriminate controller + * samples + */ + protected AbstractSummaryConsumer(boolean supportsControllersDiscrimination) { + this.supportsControllersDiscrimination = supportsControllersDiscrimination; + } + + /** + * Gets the identifier key from sample.
+ * This key is use identify the SummaryInfo linked with the sample + * + * @param sample + * the sample + * @return the key identifying the sample + */ + protected abstract String getKeyFromSample(Sample sample); + + /** + * Creates a result item for information identified by the specified key.
+ * + * @param key + * the key + * @param data + * the data + * @return the list result data + */ + protected abstract ListResultData createDataResult(String key, TData data); + + /** + * Creates the result containing titles of columns. + * + * @return the list of titles + */ + protected abstract ListResultData createResultTitles(); + + /** + * Update the stored data with the data from the specified sample. + * + * @param sample + * the sample + */ + protected abstract void updateData(SummaryInfo info, Sample sample); + + private MapResultData createResultFromKey(String key) { + SummaryInfo info = (key == null) ? overallInfo : infos.get(key); + MapResultData result = null; + TData data = info.getData(); + if (data != null) { + result = new MapResultData(); + result.setResult(RESULT_VALUE_IS_CONTROLLER, new ValueResultData( + info.isController())); + result.setResult(RESULT_VALUE_DATA, createDataResult(key, data)); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.processor.SampleConsumer#startConsuming() + */ + @Override + public void startConsuming() { + + // Broadcast metadata to consumes for each channel + int channelCount = getConsumedChannelCount(); + for (int i = 0; i < channelCount; i++) { + super.setProducedMetadata(getConsumedMetadata(i), i); + } + super.startProducing(); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.SampleConsumer#consume(org.apache. + * jmeter.report.core.Sample, int) + */ + @Override + public void consume(Sample sample, int channel) { + String key = getKeyFromSample(sample); + + // Get the object to store counters or create it if it does not exist. + SummaryInfo info = infos.get(key); + if (info == null) { + info = new SummaryInfo(supportsControllersDiscrimination + && sample.isController()); + infos.put(key, info); + } + updateData(info, sample); + super.produce(sample, channel); + } + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.processor.SampleConsumer#stopConsuming() + */ + @Override + public void stopConsuming() { + MapResultData result = new MapResultData(); + + // Push the support flag in the result + result.setResult(RESULT_VALUE_SUPPORTS_CONTROLLERS_DISCRIMINATION, + new ValueResultData(supportsControllersDiscrimination)); + + // Add headers + result.setResult(RESULT_VALUE_TITLES, createResultTitles()); + + // Add overall row if needed + if (hasOverallResult) { + MapResultData overallResult = createResultFromKey(null); + if (overallResult != null) { + result.setResult(RESULT_VALUE_OVERALL, overallResult); + } + } + + // Build rows from samples + ListResultData itemsResult = new ListResultData(); + for (String key : infos.keySet()) { + // Add result only if data exist + MapResultData keyResult = createResultFromKey(key); + if (keyResult != null) { + itemsResult.addResult(keyResult); + } + } + result.setResult(RESULT_VALUE_ITEMS, itemsResult); + + // Store the result in the context + setDataToContext(getName(), result); + + super.stopProducing(); + + // Reset infos + infos.clear(); + overallInfo.setData(null); + } +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AbstractSummaryConsumer.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregateConsumer.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregateConsumer.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregateConsumer.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregateConsumer.java Thu Dec 10 19:10:06 2015 @@ -1,117 +1,117 @@ -/* - * 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.report.processor; - -import org.apache.jmeter.report.core.ArgumentNullException; -import org.apache.jmeter.report.core.Sample; -import org.apache.jmeter.report.core.SampleSelector; - -/** - * The Class AggregateConsumer provides a consumer that can aggregate samples to - * provide a result - * - * @since 2.14 - */ -public class AggregateConsumer extends AbstractSampleConsumer { - - /** The aggregator. */ - private Aggregator aggregator; - - /** The selector. */ - private SampleSelector selector; - - /** - * Gets the aggregator. - * - * @return the aggregator - */ - public final Aggregator getAggregator() { - return aggregator; - } - - /** - * Gets the selector. - * - * @return the selector - */ - public final SampleSelector getSelector() { - return selector; - } - - /** - * Instantiates a new abstract aggregate consumer. - * - * @param aggregator - * the aggregator - * @param selector - * the selector - */ - public AggregateConsumer(Aggregator aggregator, - SampleSelector selector) { - if (aggregator == null) { - throw new ArgumentNullException("aggregator"); - } - if (selector == null) { - throw new ArgumentNullException("selector"); - } - - this.aggregator = aggregator; - this.selector = selector; - } - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.processor.SampleConsumer#startConsuming() - */ - @Override - public void startConsuming() { - // Broadcast metadata to consumes for each channel - int channelCount = getConsumedChannelCount(); - for (int i = 0; i < channelCount; i++) { - super.setProducedMetadata(getConsumedMetadata(i), i); - } - - super.startProducing(); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.jmeter.report.processor.SampleConsumer#consume(org.apache. - * jmeter.report.core.Sample, int) - */ - @Override - public void consume(Sample sample, int channel) { - aggregator.addValue(selector.select(sample)); - super.produce(sample, channel); - } - - /* - * (non-Javadoc) - * - * @see org.apache.jmeter.report.processor.SampleConsumer#stopConsuming() - */ - @Override - public void stopConsuming() { - setDataToContext(getName(), new ValueResultData(aggregator.getResult())); - super.stopProducing(); - } - -} +/* + * 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.report.processor; + +import org.apache.jmeter.report.core.ArgumentNullException; +import org.apache.jmeter.report.core.Sample; +import org.apache.jmeter.report.core.SampleSelector; + +/** + * The Class AggregateConsumer provides a consumer that can aggregate samples to + * provide a result + * + * @since 2.14 + */ +public class AggregateConsumer extends AbstractSampleConsumer { + + /** The aggregator. */ + private Aggregator aggregator; + + /** The selector. */ + private SampleSelector selector; + + /** + * Gets the aggregator. + * + * @return the aggregator + */ + public final Aggregator getAggregator() { + return aggregator; + } + + /** + * Gets the selector. + * + * @return the selector + */ + public final SampleSelector getSelector() { + return selector; + } + + /** + * Instantiates a new abstract aggregate consumer. + * + * @param aggregator + * the aggregator + * @param selector + * the selector + */ + public AggregateConsumer(Aggregator aggregator, + SampleSelector selector) { + if (aggregator == null) { + throw new ArgumentNullException("aggregator"); + } + if (selector == null) { + throw new ArgumentNullException("selector"); + } + + this.aggregator = aggregator; + this.selector = selector; + } + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.processor.SampleConsumer#startConsuming() + */ + @Override + public void startConsuming() { + // Broadcast metadata to consumes for each channel + int channelCount = getConsumedChannelCount(); + for (int i = 0; i < channelCount; i++) { + super.setProducedMetadata(getConsumedMetadata(i), i); + } + + super.startProducing(); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.jmeter.report.processor.SampleConsumer#consume(org.apache. + * jmeter.report.core.Sample, int) + */ + @Override + public void consume(Sample sample, int channel) { + aggregator.addValue(selector.select(sample)); + super.produce(sample, channel); + } + + /* + * (non-Javadoc) + * + * @see org.apache.jmeter.report.processor.SampleConsumer#stopConsuming() + */ + @Override + public void stopConsuming() { + setDataToContext(getName(), new ValueResultData(aggregator.getResult())); + super.stopProducing(); + } + +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregateConsumer.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/Aggregator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/Aggregator.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/processor/Aggregator.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/Aggregator.java Thu Dec 10 19:10:06 2015 @@ -1,53 +1,53 @@ -/* - * 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.report.processor; - -/** - * The interface Aggregator represents an aggregator used by graph consumers. - * - * @since 2.14 - */ -public interface Aggregator { - - /** - * Gets the number of aggregated values. - * - * @return the number of aggregated values - */ - long getCount(); - - /** - * Gets the result of the aggregation using stored values. - * - * @return the result of the aggregation. - */ - double getResult(); - - /** - * Adds the specified value to the storage of the current aggregator. - * - * @param value - * the value to aggregate - */ - void addValue(double value); - - /** - * Reset the state of the aggregator. - */ - void reset(); -} +/* + * 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.report.processor; + +/** + * The interface Aggregator represents an aggregator used by graph consumers. + * + * @since 2.14 + */ +public interface Aggregator { + + /** + * Gets the number of aggregated values. + * + * @return the number of aggregated values + */ + long getCount(); + + /** + * Gets the result of the aggregation using stored values. + * + * @return the result of the aggregation. + */ + double getResult(); + + /** + * Adds the specified value to the storage of the current aggregator. + * + * @param value + * the value to aggregate + */ + void addValue(double value); + + /** + * Reset the state of the aggregator. + */ + void reset(); +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/Aggregator.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregatorFactory.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregatorFactory.java?rev=1719185&r1=1719184&r2=1719185&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregatorFactory.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregatorFactory.java Thu Dec 10 19:10:06 2015 @@ -1,49 +1,49 @@ -/* - * 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.report.processor; - -/** - * A factory for creating Aggregator objects. - * - * @since 2.14 - */ -public interface AggregatorFactory { - - /** - * Creates a new Aggregator object to calculate an aggregated value in a - * graph. - * - * @return the graph data aggregator - */ - Aggregator createValueAggregator(); - - /** - * Creates a new Aggregator object to calculate an aggregated key. - * - * @return the graph data aggregator - */ - Aggregator createKeyAggregator(); - - /** - * Creates a new Aggregator object to calculate an aggregated value of an - * aggregated key series. - * - * @return the graph data aggregator - */ - Aggregator createAggregatedKeyValueAggregator(); -} +/* + * 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.report.processor; + +/** + * A factory for creating Aggregator objects. + * + * @since 2.14 + */ +public interface AggregatorFactory { + + /** + * Creates a new Aggregator object to calculate an aggregated value in a + * graph. + * + * @return the graph data aggregator + */ + Aggregator createValueAggregator(); + + /** + * Creates a new Aggregator object to calculate an aggregated key. + * + * @return the graph data aggregator + */ + Aggregator createKeyAggregator(); + + /** + * Creates a new Aggregator object to calculate an aggregated value of an + * aggregated key series. + * + * @return the graph data aggregator + */ + Aggregator createAggregatedKeyValueAggregator(); +} Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/AggregatorFactory.java ------------------------------------------------------------------------------ svn:eol-style = native