Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java Wed Dec 6 22:21:19 2017 @@ -26,8 +26,8 @@ import java.util.Iterator; import org.apache.commons.lang3.StringUtils; import org.apache.jmeter.protocol.http.util.ConversionUtils; -import org.slf4j.LoggerFactory; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -37,7 +37,6 @@ import org.xml.sax.SAXException; /** * HtmlParser implementation using JTidy. - * */ class JTidyHTMLParser extends HTMLParser { private static final Logger log = LoggerFactory.getLogger(JTidyHTMLParser.class); @@ -51,7 +50,7 @@ class JTidyHTMLParser extends HTMLParser */ @Override public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException { - Document dom = null; + Document dom; try { dom = (Document) getDOM(html, encoding); } catch (SAXException se) {
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/URLCollection.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/URLCollection.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/URLCollection.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/URLCollection.java Wed Dec 6 22:21:19 2017 @@ -26,8 +26,8 @@ import java.util.Iterator; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.Validate; import org.apache.jmeter.protocol.http.util.ConversionUtils; -import org.slf4j.LoggerFactory; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Collection class designed for handling URLs @@ -37,7 +37,6 @@ import org.slf4j.Logger; * <p> * N.B. Designed for use by HTMLParser, so is not a full implementation - e.g. * does not support remove() - * */ public class URLCollection implements Iterable<URL> { private static final Logger log = LoggerFactory.getLogger(URLCollection.class); @@ -105,7 +104,6 @@ public class URLCollection implements It /* * Private iterator used to unwrap the URL from the URLString class - * */ private static class UrlIterator implements Iterator<URL> { private final Iterator<URLString> iter; Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java Wed Dec 6 22:21:19 2017 @@ -28,15 +28,13 @@ import java.util.HashMap; import java.util.Map; import org.apache.jmeter.gui.Stoppable; -import org.slf4j.LoggerFactory; import org.apache.jorphan.util.JOrphanUtils; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Web daemon thread. Creates main socket on port configured port (8888 by default) and listens on it - * forever. For each client request, creates a Proxy thread to handle the - * request. - * + * forever. For each client request, creates a Proxy thread to handle the request. */ public class Daemon extends Thread implements Stoppable { Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java Wed Dec 6 22:21:19 2017 @@ -22,13 +22,13 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.jmeter.protocol.http.parser.HTMLParseException; -import org.slf4j.LoggerFactory; import org.apache.jorphan.util.JOrphanUtils; -import org.slf4j.Logger; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A parser for html, to find the form tags, and their accept-charset value Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java Wed Dec 6 22:21:19 2017 @@ -39,14 +39,11 @@ import org.apache.jmeter.protocol.http.u import org.apache.jmeter.protocol.http.util.HTTPConstants; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.util.JMeterUtils; -import org.slf4j.LoggerFactory; import org.slf4j.Logger; - -//For unit tests, @see TestHttpRequestHdr +import org.slf4j.LoggerFactory; /** * The headers of the client HTTP request. - * */ public class HttpRequestHdr { private static final Logger log = LoggerFactory.getLogger(HttpRequestHdr.class); Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Wed Dec 6 22:21:19 2017 @@ -52,17 +52,16 @@ import org.apache.jmeter.samplers.Sample import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.threads.JMeterContextService; import org.apache.jmeter.util.JMeterUtils; -import org.slf4j.LoggerFactory; import org.apache.jorphan.util.JMeterException; import org.apache.jorphan.util.JOrphanUtils; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Thread to handle one client request. Gets the request from the client and * passes it on to the server, then sends the response back to the client. * Information about the request and response is stored so it can be used in a * JMeter test plan. - * */ public class Proxy extends Thread { private static final Logger log = LoggerFactory.getLogger(Proxy.class); @@ -185,7 +184,8 @@ public class Proxy extends Thread { if ((request.getMethod().startsWith(HTTPConstants.CONNECT)) && (outStreamClient != null)) { log.debug("{} Method CONNECT => SSL", port); // write a OK response to browser, to engage SSL exchange - outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$ + outStreamClient.write( + "HTTP/1.0 200 OK\r\n\r\n".getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$ outStreamClient.flush(); // With ssl request, url is host:port (without https:// or path) String[] param = request.getUrl().split(":"); // $NON-NLS-1$ Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java Wed Dec 6 22:21:19 2017 @@ -25,9 +25,9 @@ import java.util.List; import java.util.Map; import org.apache.jmeter.util.JMeterUtils; -import org.slf4j.LoggerFactory; import org.apache.jorphan.reflect.ClassFinder; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * {@link SamplerCreator} factory @@ -39,9 +39,6 @@ public class SamplerCreatorFactory { private final Map<String, SamplerCreator> samplerCreatorMap = new HashMap<>(); - /** - * - */ public SamplerCreatorFactory() { init(); } Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSamplerBeanInfo.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSamplerBeanInfo.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSamplerBeanInfo.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSamplerBeanInfo.java Wed Dec 6 22:21:19 2017 @@ -31,9 +31,9 @@ import org.apache.jmeter.protocol.http.u import org.apache.jmeter.testbeans.BeanInfoSupport; import org.apache.jmeter.testbeans.gui.FileEditor; import org.apache.jmeter.util.JMeterUtils; -import org.slf4j.LoggerFactory; import org.apache.jorphan.reflect.ClassFinder; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AccessLogSamplerBeanInfo extends BeanInfoSupport { private static final Logger log = LoggerFactory.getLogger(AccessLogSamplerBeanInfo.class); Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Wed Dec 6 22:21:19 2017 @@ -507,8 +507,9 @@ public class HTTPHC4Impl extends HTTPHCA res.setBodySize(totalBytes - headerBytes); res.setSentBytes(metrics.getSentBytesCount()); if (log.isDebugEnabled()) { + long total = res.getHeadersSize() + res.getBodySizeAsLong(); log.debug("ResponseHeadersSize={} Content-Length={} Total={}", - res.getHeadersSize(), res.getBodySizeAsLong(), (res.getHeadersSize() + res.getBodySizeAsLong())); + res.getHeadersSize(), res.getBodySizeAsLong(), total); } // If we redirected automatically, the URL may have changed @@ -1101,30 +1102,29 @@ public class HTTPHC4Impl extends HTTPHCA if (headers != null) { for (JMeterProperty jMeterProperty : headers) { org.apache.jmeter.protocol.http.control.Header header - = (org.apache.jmeter.protocol.http.control.Header) + = (org.apache.jmeter.protocol.http.control.Header) jMeterProperty.getObjectValue(); - String n = header.getName(); + String headerName = header.getName(); // Don't allow override of Content-Length // TODO - what other headers are not allowed? - if (! HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){ - String v = header.getValue(); - if (HTTPConstants.HEADER_HOST.equalsIgnoreCase(n)) { - int port = getPortFromHostHeader(v, url.getPort()); - v = v.replaceFirst(":\\d+$",""); // remove any port specification // $NON-NLS-1$ $NON-NLS-2$ - if (port != -1) { - if (port == url.getDefaultPort()) { - port = -1; // no need to specify the port if it is the default - } + if (!HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(headerName)) { + String headerValue = header.getValue(); + if (HTTPConstants.HEADER_HOST.equalsIgnoreCase(headerName)) { + int port = getPortFromHostHeader(headerValue, url.getPort()); + // remove any port specification + headerValue = headerValue.replaceFirst(":\\d+$", ""); // $NON-NLS-1$ $NON-NLS-2$ + if (port != -1 && port == url.getDefaultPort()) { + port = -1; // no need to specify the port if it is the default } - request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(v, port)); + request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(headerValue, port)); } else { - request.addHeader(n, v); + request.addHeader(headerName, headerValue); } } } } } - if (cacheManager != null){ + if (cacheManager != null) { cacheManager.setHeaders(url, request); } } Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/ConversionUtils.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/ConversionUtils.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/ConversionUtils.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/ConversionUtils.java Wed Dec 6 22:21:19 2017 @@ -229,45 +229,37 @@ public class ConversionUtils { StringTokenizer st = new StringTokenizer(currentPath, SLASH); List<String> tokens = new ArrayList<>(); - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { tokens.add(st.nextToken()); } - for (int i = 0; i < tokens.size(); i++) - { - if (i < tokens.size() - 1) - { + for (int i = 0; i < tokens.size(); i++) { + if (i < tokens.size() - 1) { final String thisToken = tokens.get(i); // Verify for a ".." component at next iteration - if (thisToken.length() > 0 && !thisToken.equals(DOTDOT) && tokens.get(i + 1).equals(DOTDOT)) - { + if (thisToken.length() > 0 && !thisToken.equals(DOTDOT) && tokens.get(i + 1).equals(DOTDOT)) { tokens.remove(i); tokens.remove(i); - i = i - 2; - if (i < -1) - { - i = -1; + i = i - 2; // CHECKSTYLE IGNORE ModifiedControlVariable + if (i < -1) { + i = -1; // CHECKSTYLE IGNORE ModifiedControlVariable } } } - } StringBuilder newPath = new StringBuilder(); if (startsWithSlash) { newPath.append(SLASH); } - for (int i = 0; i < tokens.size(); i++) - { + for (int i = 0; i < tokens.size(); i++) { newPath.append(tokens.get(i)); // append '/' if this isn't the last token or it is but the original // path terminated w/ a '/' boolean appendSlash = i < (tokens.size() - 1) ? true : endsWithSlash; - if (appendSlash) - { + if (appendSlash) { newPath.append(SLASH); } } Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java Wed Dec 6 22:21:19 2017 @@ -18,20 +18,18 @@ package org.apache.jmeter.protocol.http.util; - /** * Constants used in HTTP, mainly header names. */ - public interface HTTPConstantsInterface { // CHECKSTYLE IGNORE InterfaceIsType String SC_MOVED_PERMANENTLY = "301"; String SC_MOVED_TEMPORARILY = "302"; String SC_SEE_OTHER = "303"; String SC_TEMPORARY_REDIRECT = "307"; - + int DEFAULT_HTTPS_PORT = 443; String DEFAULT_HTTPS_PORT_STRING = "443"; // $NON-NLS-1$ - int DEFAULT_HTTP_PORT = 80; + int DEFAULT_HTTP_PORT = 80; String DEFAULT_HTTP_PORT_STRING = "80"; // $NON-NLS-1$ String PROTOCOL_HTTP = "http"; // $NON-NLS-1$ String PROTOCOL_HTTPS = "https"; // $NON-NLS-1$ Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPResultConverter.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPResultConverter.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPResultConverter.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPResultConverter.java Wed Dec 6 22:21:19 2017 @@ -28,15 +28,14 @@ import org.apache.jmeter.protocol.http.s import org.apache.jmeter.samplers.SampleSaveConfiguration; import org.apache.jmeter.save.converters.SampleResultConverter; -import com.thoughtworks.xstream.mapper.Mapper; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import com.thoughtworks.xstream.mapper.Mapper; /** * Class for XStream conversion of HTTPResult - * */ public class HTTPResultConverter extends SampleResultConverter { Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java Wed Dec 6 22:21:19 2017 @@ -23,13 +23,11 @@ import java.util.ArrayList; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.util.JMeterUtils; -import org.slf4j.LoggerFactory; -import org.slf4j.Logger; import org.apache.oro.text.MalformedCachePatternException; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Compiler; - -// For JUnit tests, @see TestLogFilter +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Description:<br> @@ -68,7 +66,6 @@ import org.apache.oro.text.regex.Perl5Co * which will return null if it is filtered and replace any part of the string * that should be replaced. */ - public class LogFilter implements Filter, Serializable { private static final long serialVersionUID = 241L; @@ -103,9 +100,6 @@ public class LogFilter implements Filter protected String NEWFILE = null; - /** - * The default constructor is empty - */ public LogFilter() { super(); } Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java Wed Dec 6 22:21:19 2017 @@ -30,15 +30,14 @@ import org.apache.jmeter.testelement.Tes import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.ThreadListener; import org.apache.jmeter.util.JMeterUtils; -import org.slf4j.LoggerFactory; -import org.slf4j.Logger; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Compiler; import org.apache.oro.text.regex.Perl5Matcher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Provides Session Filtering for the AccessLog Sampler. - * */ public class SessionFilter implements Filter, Serializable, TestCloneable,ThreadListener { private static final long serialVersionUID = 233L; Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java Wed Dec 6 22:21:19 2017 @@ -26,9 +26,9 @@ import java.io.Serializable; import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory; -import org.slf4j.LoggerFactory; import org.apache.jorphan.util.JOrphanUtils; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Description:<br> @@ -50,7 +50,6 @@ import org.slf4j.Logger; * added and should be left up to the user. One option is to provide parameters, * so the user can pass the desired listener to the tool. */ - public class StandardGenerator implements Generator, Serializable { private static final long serialVersionUID = 234L; @@ -58,11 +57,8 @@ public class StandardGenerator implement private static final Logger log = LoggerFactory.getLogger(StandardGenerator.class); protected HTTPSamplerBase SAMPLE = null; - protected transient OutputStream OUTPUT = null; - protected String FILENAME = null; - protected File FILE = null; /** Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java Wed Dec 6 22:21:19 2017 @@ -34,10 +34,8 @@ import java.util.zip.GZIPInputStream; import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; import org.apache.jmeter.testelement.TestElement; -import org.slf4j.LoggerFactory; import org.slf4j.Logger; - -// For JUnit tests, @see TestTCLogParser +import org.slf4j.LoggerFactory; /** * Description:<br> @@ -95,9 +93,7 @@ public class TCLogParser implements LogP /** protected members * */ protected String RMETHOD = null; - /** - * The path to the access log file - */ + /** The path to the access log file */ protected String URL_PATH = null; protected boolean useFILE = true; @@ -108,21 +104,14 @@ public class TCLogParser implements LogP protected BufferedReader READER = null; - /** - * Handles to supporting classes - */ + /** Handles to supporting classes */ protected Filter FILTER = null; - /** - * by default, we probably should decode the parameter values - */ + /** by default, we probably should decode the parameter values */ protected boolean decode = true; // TODO downcase UPPER case non-final variables - /** - * - */ public TCLogParser() { super(); } Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java Wed Dec 6 22:21:19 2017 @@ -54,13 +54,12 @@ import org.apache.jmeter.visualizers.Sea import org.apache.jorphan.gui.GuiUtils; import org.apache.jorphan.gui.ObjectTableModel; import org.apache.jorphan.gui.RendererUtils; -import org.slf4j.LoggerFactory; import org.apache.jorphan.reflect.Functor; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Specializer panel to view a HTTP request parsed - * */ public class RequestViewHTTP implements RequestView { @@ -281,10 +280,7 @@ public class RequestViewHTTP implements */ private boolean isMultipart(LinkedHashMap<String, String> headers) { String contentType = headers.get(HTTPConstants.HEADER_CONTENT_TYPE); - if (contentType != null && contentType.startsWith(HTTPConstants.MULTIPART_FORM_DATA)) { - return true; - } - return false; + return contentType != null && contentType.startsWith(HTTPConstants.MULTIPART_FORM_DATA); } /** @@ -455,7 +451,7 @@ public class RequestViewHTTP implements Object o = tableParams.getModel().getValueAt(i, j); if(o instanceof String) { Matcher matcher = pattern.matcher((String) o); - if ((matcher != null) && (matcher.find())) { + if (matcher.find()) { found = true; tableParams.setRowSelectionInterval(i, i); tableParams.scrollRectToVisible(tableParams.getCellRect(i, 0, true)); Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java (original) +++ jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java Wed Dec 6 22:21:19 2017 @@ -27,14 +27,14 @@ import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; +import org.apache.jmeter.gui.util.FilePanelEntry; +import org.apache.jmeter.gui.util.JSyntaxTextArea; +import org.apache.jmeter.gui.util.JTextScrollPane; import org.apache.jmeter.protocol.java.sampler.BeanShellSampler; import org.apache.jmeter.samplers.gui.AbstractSamplerGui; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.property.BooleanProperty; import org.apache.jmeter.util.JMeterUtils; -import org.apache.jmeter.gui.util.JSyntaxTextArea; -import org.apache.jmeter.gui.util.JTextScrollPane; -import org.apache.jmeter.gui.util.FilePanelEntry; public class BeanShellSamplerGui extends AbstractSamplerGui { Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java (original) +++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java Wed Dec 6 22:21:19 2017 @@ -476,7 +476,7 @@ public abstract class AbstractJDBCTestEl throw new SQLException("Invalid data type: "+jdbcType, e); } } - return (entry).intValue(); + return entry.intValue(); } Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/ClientPool.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/ClientPool.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/ClientPool.java (original) +++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/ClientPool.java Wed Dec 6 22:21:19 2017 @@ -55,17 +55,14 @@ public class ClientPool { * need to do this to make sure all the threads created during the test are * destroyed and cleaned up. In some cases, the client provided by the * manufacturer of the JMS server may have bugs and some threads may become - * zombie. In those cases, it is not the responsibility of JMeter for those - * bugs. + * zombie. In those cases, it is not JMeter's responsibility. */ public static synchronized void clearClient() { for (Closeable client : clients) { try { client.close(); - } catch (IOException e) { - // Ignored + } catch (IOException ignored) { } - client = null; } clients.clear(); client_map.clear(); Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java (original) +++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java Wed Dec 6 22:21:19 2017 @@ -45,7 +45,6 @@ import org.apache.jorphan.gui.JLabeledTe /** * This is the GUI for JMS Publisher - * */ public class JMSPublisherGui extends AbstractSamplerGui implements ChangeListener { @@ -223,7 +222,8 @@ public class JMSPublisherGui extends Abs msgChoice.setLayout(new BoxLayout(msgChoice, BoxLayout.X_AXIS)); mainPanel.add(msgChoice); - fileEncoding = new JLabeledChoice(JMeterUtils.getResString("content_encoding") + "\u00A0\u00A0", // $NON-NLS-1$ + String nonBreakingSpace = "\u00A0"; // CHECKSTYLE IGNORE AvoidEscapedUnicodeCharacters + fileEncoding = new JLabeledChoice(JMeterUtils.getResString("content_encoding") + nonBreakingSpace + nonBreakingSpace, // $NON-NLS-1$ PublisherSampler.getSupportedEncodings(), true, false); fileEncoding.setLayout(new BoxLayout(fileEncoding, BoxLayout.X_AXIS)); fileEncoding.add(Box.createHorizontalGlue()); Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSamplerGui.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSamplerGui.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSamplerGui.java (original) +++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSamplerGui.java Wed Dec 6 22:21:19 2017 @@ -43,8 +43,7 @@ import org.apache.jorphan.gui.JLabeledCh import org.apache.jorphan.gui.JLabeledTextField; /** - * Configuration screen for Java Messaging Point-to-Point requests. <br> - * + * Configuration screen for Java Messaging Point-to-Point requests. */ public class JMSSamplerGui extends AbstractSamplerGui { Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java (original) +++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java Wed Dec 6 22:21:19 2017 @@ -343,7 +343,7 @@ public class JMSSampler extends Abstract } catch (Exception ex) { res.setResponseMessage("Error browsing queue '"+queueName+"'Â with selector '" + jmsSelector+ "', timeout '"+getTimeout()+"', message:"+ex.getMessage()); - LOGGER.error("Error browsing queue {}Â with selector {} and configured timeout {}", queueName, jmsSelector, + LOGGER.error("Error browsing queue {}Â with selector {} and configured timeout {}", queueName, jmsSelector, getTimeout(), ex); } finally { Utils.close(consumer, LOGGER); @@ -424,7 +424,7 @@ public class JMSSampler extends Abstract } res.setResponseMessage(numMsgs + " messages available on the queue"); res.setResponseHeaders(qBrowser.toString()); - return (messageBodies + queue.getQueueName() + " has " + numMsgs + " messages"); + return messageBodies + queue.getQueueName() + " has " + numMsgs + " messages"; } catch (Exception e) { res.setResponseMessage("Error counting message on the queue"); LOGGER.error("Error browsing messages on the queue {}", queueName, e); @@ -668,21 +668,21 @@ public class JMSSampler extends Abstract LOGGER.debug("Session created"); - if (isBrowse() || isRead() || isClearQueue()) { - // Do nothing! - } else if (isOneway()) { - producer = session.createSender(sendQueue); - if (isNonPersistent()) { - producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - } - producer.setPriority(Integer.parseInt(getPriority())); - producer.setTimeToLive(Long.parseLong(getExpiration())); - } else { - if (useTemporyQueue()) { - executor = new TemporaryQueueExecutor(session, sendQueue, getTimeoutAsInt()); - } else { + if (!(isBrowse() || isRead() || isClearQueue())) { + if (isOneway()) { producer = session.createSender(sendQueue); - executor = new FixedQueueExecutor(producer, getTimeoutAsInt(), isUseReqMsgIdAsCorrelId()); + if (isNonPersistent()) { + producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + } + producer.setPriority(Integer.parseInt(getPriority())); + producer.setTimeToLive(Long.parseLong(getExpiration())); + } else { + if (useTemporyQueue()) { + executor = new TemporaryQueueExecutor(session, sendQueue, getTimeoutAsInt()); + } else { + producer = session.createSender(sendQueue); + executor = new FixedQueueExecutor(producer, getTimeoutAsInt(), isUseReqMsgIdAsCorrelId()); + } } } LOGGER.debug("Starting connection"); Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/render/ObjectMessageRenderer.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/render/ObjectMessageRenderer.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/render/ObjectMessageRenderer.java (original) +++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/render/ObjectMessageRenderer.java Wed Dec 6 22:21:19 2017 @@ -102,7 +102,6 @@ class ObjectMessageRenderer implements M } protected Serializable getContent(String filename) { - Serializable object = (Serializable) new XStream().fromXML(new File(filename)); - return object; + return (Serializable) new XStream().fromXML(new File(filename)); } } Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java (original) +++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java Wed Dec 6 22:21:19 2017 @@ -24,10 +24,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.jmeter.config.ConfigTestElement; import org.apache.jmeter.testelement.property.CollectionProperty; import org.apache.jmeter.testelement.property.PropertyIterator; import org.apache.jmeter.testelement.property.TestElementProperty; -import org.apache.jmeter.config.ConfigTestElement; /** * A set of LDAPArgument objects. author Dolf Smits([email protected]) Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java (original) +++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java Wed Dec 6 22:21:19 2017 @@ -28,16 +28,15 @@ import javax.swing.ButtonGroup; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JTextField; -import javax.swing.JPasswordField; import org.apache.jmeter.config.ConfigTestElement; import org.apache.jmeter.config.gui.AbstractConfigGui; import org.apache.jmeter.config.gui.ArgumentsPanel; import org.apache.jmeter.gui.util.VerticalPanel; import org.apache.jmeter.protocol.ldap.sampler.LDAPExtSampler; -import org.apache.jmeter.protocol.ldap.config.gui.LDAPArgumentsPanel; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.property.StringProperty; import org.apache.jmeter.testelement.property.TestElementProperty; Modified: jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java (original) +++ jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java Wed Dec 6 22:21:19 2017 @@ -83,20 +83,16 @@ public class MongoSourceElement this.source = source; } - - public static MongoDB getMongoDB(String source) { Object mongoSource = JMeterContextService.getContext().getVariables().getObject(source); if(mongoSource == null) { throw new IllegalStateException("mongoSource is null"); - } - else { + } else { if(mongoSource instanceof MongoDB) { return (MongoDB)mongoSource; - } - else { + } else { throw new IllegalStateException("Variable:"+ source +" is not a MongoDB instance, class:"+mongoSource.getClass()); } } @@ -155,7 +151,8 @@ public class MongoSourceElement log.debug(getSource() + " is being defined."); } try { - getThreadContext().getVariables().putObject(getSource(), new MongoDB(MongoUtils.toServerAddresses(getConnection()), mongoOptions)); + getThreadContext().getVariables().putObject( + getSource(), new MongoDB(MongoUtils.toServerAddresses(getConnection()), mongoOptions)); } catch (UnknownHostException e) { throw new IllegalStateException(e); } Modified: jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java (original) +++ jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java Wed Dec 6 22:21:19 2017 @@ -24,8 +24,6 @@ import org.apache.jmeter.testbeans.BeanI import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - */ public class MongoSourceElementBeanInfo extends BeanInfoSupport { Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/control/gui/TCPSamplerGui.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/control/gui/TCPSamplerGui.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/control/gui/TCPSamplerGui.java (original) +++ jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/control/gui/TCPSamplerGui.java Wed Dec 6 22:21:19 2017 @@ -21,6 +21,7 @@ package org.apache.jmeter.protocol.tcp.c import java.awt.BorderLayout; import javax.swing.BorderFactory; + import org.apache.jmeter.config.gui.LoginConfigGui; import org.apache.jmeter.gui.util.VerticalPanel; import org.apache.jmeter.protocol.tcp.config.gui.TCPConfigGui; @@ -34,7 +35,6 @@ public class TCPSamplerGui extends Abstr private static final long serialVersionUID = 240L; private LoginConfigGui loginPanel; - private TCPConfigGui tcpDefaultPanel; public TCPSamplerGui() { Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java (original) +++ jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java Wed Dec 6 22:21:19 2017 @@ -77,7 +77,7 @@ public class BinaryTCPClientImpl extends throw new IllegalArgumentException( "Hex-encoded binary string contains an invalid hex digit in '"+sc[i * 2]+sc[i * 2 + 1]+"'"); } - ba[i] = (byte) ((nibble0 << 4) | (nibble1)); + ba[i] = (byte) ((nibble0 << 4) | nibble1); } return ba; Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java (original) +++ jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java Wed Dec 6 22:21:19 2017 @@ -486,11 +486,11 @@ public class TCPSampler extends Abstract } // Cannot do this as part of threadStarted() because the Config elements have not been processed. - private void initSampling(){ + private void initSampling() { protocolHandler = getProtocol(); - if(log.isDebugEnabled()) { + if (log.isDebugEnabled()) { log.debug("Using Protocol Handler: {}", //$NON-NLS-1$ - (protocolHandler == null ? "NONE" : protocolHandler.getClass().getName())); //$NON-NLS-1$ + protocolHandler == null ? "NONE" : protocolHandler.getClass().getName()); //$NON-NLS-1$ } if (protocolHandler != null){ protocolHandler.setupTest(); @@ -555,11 +555,10 @@ public class TCPSampler extends Abstract @Override public boolean interrupt() { Optional<Socket> sock = Optional.ofNullable(currentSocket); // fetch in case gets nulled later - if(sock.isPresent()) { + if (sock.isPresent()) { try { sock.get().close(); - } catch (IOException e) { - // ignored + } catch (IOException ignored) { } return true; } else { Modified: jmeter/trunk/test/src/org/apache/jmeter/control/TestTransactionController.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/control/TestTransactionController.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/control/TestTransactionController.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/control/TestTransactionController.java Wed Dec 6 22:21:19 2017 @@ -13,7 +13,7 @@ * 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.control; Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/SumFunctionTest.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/SumFunctionTest.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/functions/SumFunctionTest.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/functions/SumFunctionTest.java Wed Dec 6 22:21:19 2017 @@ -20,8 +20,10 @@ package org.apache.jmeter.functions; import static org.junit.Assert.assertEquals; +import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; +import java.util.stream.Collectors; import org.apache.jmeter.engine.util.CompoundVariable; import org.apache.jmeter.junit.JMeterTestCase; @@ -33,67 +35,62 @@ import org.junit.Test; public class SumFunctionTest extends JMeterTestCase { - private JMeterContext jmctx = null; private JMeterVariables vars = null; - + @Before public void setUp() { - jmctx = JMeterContextService.getContext(); + JMeterContext jmctx = JMeterContextService.getContext(); jmctx.setVariables(new JMeterVariables()); vars = jmctx.getVariables(); } - + @Test public void sumTest() throws Exception { String maxIntVal = Integer.toString(Integer.MAX_VALUE); String minIntVal = Integer.toString(Integer.MIN_VALUE); - { // prevent accidental use of is below - IntSum is = new IntSum(); - checkInvalidParameterCounts(is, 2); - checkSum(is,"3", new String[]{"1","2"}); - checkSumNoVar(is,"3", new String[]{"1","2"}); - checkSum(is,"1", new String[]{"-1","1","1","1","-2","1"}); - checkSumNoVar(is,"1", new String[]{"-1","1","1","1","-2","1"}); - checkSumNoVar(is,"-1", new String[]{"-1","1","1","1","-2","-1"}); - checkSum(is,maxIntVal, new String[]{maxIntVal,"0"}); - checkSum(is,minIntVal, new String[]{maxIntVal,"1"}); // wrap-round check - } - - LongSum ls = new LongSum(); - checkInvalidParameterCounts(ls, 2); - checkSum(ls,"3", new String[]{"1","2"}); - checkSum(ls,"1", new String[]{"-1","1","1","1","-1","0"}); - checkSumNoVar(ls,"3", new String[]{"1","2"}); - checkSumNoVar(ls,"1", new String[]{"-1","1","1","1","-1","0"}); - checkSumNoVar(ls,"0", new String[]{"-1","1","1","1","-1","-1"}); + IntSum intSum = new IntSum(); + checkInvalidParameterCounts(intSum, 2); + checkSum(intSum,"3", new String[]{"1","2"}); + checkSumNoVar(intSum,"3", new String[]{"1","2"}); + checkSum(intSum,"1", new String[]{"-1","1","1","1","-2","1"}); + checkSumNoVar(intSum,"1", new String[]{"-1","1","1","1","-2","1"}); + checkSumNoVar(intSum,"-1", new String[]{"-1","1","1","1","-2","-1"}); + checkSum(intSum,maxIntVal, new String[]{maxIntVal,"0"}); + checkSum(intSum,minIntVal, new String[]{maxIntVal,"1"}); // wrap-round check + + LongSum longSum = new LongSum(); + checkInvalidParameterCounts(longSum, 2); + checkSum(longSum,"3", new String[]{"1","2"}); + checkSum(longSum,"1", new String[]{"-1","1","1","1","-1","0"}); + checkSumNoVar(longSum,"3", new String[]{"1","2"}); + checkSumNoVar(longSum,"1", new String[]{"-1","1","1","1","-1","0"}); + checkSumNoVar(longSum,"0", new String[]{"-1","1","1","1","-1","-1"}); String maxIntVal_1 = Long.toString(1+(long)Integer.MAX_VALUE); - checkSum(ls,maxIntVal, new String[]{maxIntVal,"0"}); - checkSum(ls,maxIntVal_1, new String[]{maxIntVal,"1"}); // no wrap-round check + checkSum(longSum,maxIntVal, new String[]{maxIntVal,"0"}); + checkSum(longSum,maxIntVal_1, new String[]{maxIntVal,"1"}); // no wrap-round check String maxLongVal = Long.toString(Long.MAX_VALUE); String minLongVal = Long.toString(Long.MIN_VALUE); - checkSum(ls,maxLongVal, new String[]{maxLongVal,"0"}); - checkSum(ls,minLongVal, new String[]{maxLongVal,"1"}); // wrap-round check + checkSum(longSum,maxLongVal, new String[]{maxLongVal,"0"}); + checkSum(longSum,minLongVal, new String[]{maxLongVal,"1"}); // wrap-round check } - + // Perform a sum and check the results - private void checkSum(AbstractFunction func, String value, String [] addends) throws Exception { - Collection<CompoundVariable> parms = new LinkedList<>(); - for (String addend : addends) { - parms.add(new CompoundVariable(addend)); - } + private void checkSum(AbstractFunction func, String value, String[] addends) throws Exception { + Collection<CompoundVariable> parms = Arrays.stream(addends) + .map(CompoundVariable::new) + .collect(Collectors.toCollection(LinkedList::new)); parms.add(new CompoundVariable("Result")); func.setParameters(parms); assertEquals(value, func.execute(null,null)); - assertEquals(value, vars.getObject("Result")); + assertEquals(value, vars.getObject("Result")); } - + // Perform a sum and check the results - private void checkSumNoVar(AbstractFunction func, String value, String [] addends) throws Exception { - Collection<CompoundVariable> parms = new LinkedList<>(); - for (String addend : addends) { - parms.add(new CompoundVariable(addend)); - } + private void checkSumNoVar(AbstractFunction func, String value, String[] addends) throws Exception { + Collection<CompoundVariable> parms = Arrays.stream(addends) + .map(CompoundVariable::new) + .collect(Collectors.toCollection(LinkedList::new)); func.setParameters(parms); assertEquals(value,func.execute(null,null)); } Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java Wed Dec 6 22:21:19 2017 @@ -38,7 +38,7 @@ import org.junit.Test; * */ public class TestDigestFunction extends JMeterTestCase { - protected AbstractFunction digest; + protected AbstractFunction digest; private SampleResult result; @@ -50,7 +50,7 @@ public class TestDigestFunction extends @Before public void setUp() { - digest = new DigestEncodeFunction(); + digest = new DigestEncodeFunction(); result = new SampleResult(); jmctx = JMeterContextService.getContext(); String data = "dummy data"; @@ -64,17 +64,17 @@ public class TestDigestFunction extends @Test public void testParameterCount512() throws Exception { - checkInvalidParameterCounts(digest, 2, 5); + checkInvalidParameterCounts(digest, 2, 5); } @Test public void testSha512WithSalt() throws Exception { - params.add(new CompoundVariable("SHA-512")); - params.add(new CompoundVariable("nofile")); - params.add(new CompoundVariable("salt")); - digest.setParameters(params); - String returnValue = digest.execute(result, null); - assertEquals("abc8c7a1c814c74d5882e527d21fabfccf480716df9d17bae73e5e767992d8a2a47033459a9ea91aca3186f75bfbe559419109bc44c1e6dfd618101fdc0beb1b", returnValue); + params.add(new CompoundVariable("SHA-512")); + params.add(new CompoundVariable("nofile")); + params.add(new CompoundVariable("salt")); + digest.setParameters(params); + String returnValue = digest.execute(result, null); + assertEquals("abc8c7a1c814c74d5882e527d21fabfccf480716df9d17bae73e5e767992d8a2a47033459a9ea91aca3186f75bfbe559419109bc44c1e6dfd618101fdc0beb1b", returnValue); } @Test @@ -99,32 +99,32 @@ public class TestDigestFunction extends @Test public void testSha1() throws Exception { - params.add(new CompoundVariable("SHA-1")); - params.add(new CompoundVariable("nofile")); - digest.setParameters(params); - String returnValue = digest.execute(result, null); - assertEquals("4ea2ced10057872be25371cfe638d3b096c58f2f", returnValue); + params.add(new CompoundVariable("SHA-1")); + params.add(new CompoundVariable("nofile")); + digest.setParameters(params); + String returnValue = digest.execute(result, null); + assertEquals("4ea2ced10057872be25371cfe638d3b096c58f2f", returnValue); } @Test public void testSha1Variable() throws Exception { - params.add(new CompoundVariable("SHA-1")); - params.add(new CompoundVariable("nofile")); - params.add(new CompoundVariable("")); - params.add(new CompoundVariable("true")); - params.add(new CompoundVariable("newVar")); - digest.setParameters(params); - String returnValue = digest.execute(result, null); - assertEquals("4EA2CED10057872BE25371CFE638D3B096C58F2F", returnValue); + params.add(new CompoundVariable("SHA-1")); + params.add(new CompoundVariable("nofile")); + params.add(new CompoundVariable("")); + params.add(new CompoundVariable("true")); + params.add(new CompoundVariable("newVar")); + digest.setParameters(params); + String returnValue = digest.execute(result, null); + assertEquals("4EA2CED10057872BE25371CFE638D3B096C58F2F", returnValue); } @Test - public void testSha512Variable() throws Exception { - params.add(new CompoundVariable("SHA-512")); - params.add(new CompoundVariable("nofile")); - params.add(new CompoundVariable("")); - params.add(new CompoundVariable("true")); - params.add(new CompoundVariable("newVar")); + public void testSha512Variable() throws Exception { + params.add(new CompoundVariable("SHA-512")); + params.add(new CompoundVariable("nofile")); + params.add(new CompoundVariable("")); + params.add(new CompoundVariable("true")); + params.add(new CompoundVariable("newVar")); digest.setParameters(params); String returnValue = digest.execute(result, null); assertEquals("58DA94D45A97B35B31D7F76D2EBAC184BC4BDA512B966CDBE43FDE1CAE1CFAF89617082CA89928FB5DC1C75D60B93ADB5631F518F970CA6DCC196E1AFC678B8C", returnValue); @@ -132,15 +132,15 @@ public class TestDigestFunction extends @Test(expected=InvalidVariableException.class) public void testSha512Error() throws Exception { - params.add(new CompoundVariable("nofile")); - digest.setParameters(params); - digest.execute(result, null); + params.add(new CompoundVariable("nofile")); + digest.setParameters(params); + digest.execute(result, null); } @Test(expected=InvalidVariableException.class) - public void testSha1Error() throws Exception { - params.add(new CompoundVariable("SHA-1")); - digest.setParameters(params); - digest.execute(result, null); - } + public void testSha1Error() throws Exception { + params.add(new CompoundVariable("SHA-1")); + digest.setParameters(params); + digest.execute(result, null); + } } Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileToString.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileToString.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileToString.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileToString.java Wed Dec 6 22:21:19 2017 @@ -102,4 +102,4 @@ public class TestFileToString extends JM Assert.assertTrue(returnValue.indexOf("language=")>0); Assert.assertTrue(vars.get("MY_FILE_AS_TEXT").indexOf("language=")>0); } -} \ No newline at end of file +} Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java Wed Dec 6 22:21:19 2017 @@ -407,7 +407,7 @@ public class TestHTTPMirrorThread extend long now = System.nanoTime(); conn.connect(); final InputStream inputStream = conn.getInputStream(); - while(inputStream.read() != -1) {} + while(inputStream.read() != -1) {} // CHECKSTYLE IGNORE EmptyBlock inputStream.close(); final long elapsed = (System.nanoTime() - now)/1000000L; assertTrue("Expected > 990 " + elapsed, elapsed >= 990); Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java Wed Dec 6 22:21:19 2017 @@ -17,7 +17,8 @@ */ package org.apache.jmeter.protocol.http.parser; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; import org.junit.Test; @@ -25,18 +26,16 @@ public class TestBaseParser { @Test public void testReusableCache() throws Exception { - LinkExtractorParser parser = BaseParser - .getParser(ReusableParser.class.getCanonicalName()); - assertSame(parser, BaseParser.getParser(ReusableParser.class - .getCanonicalName())); + assertSame( + BaseParser.getParser(ReusableParser.class.getCanonicalName()), + BaseParser.getParser(ReusableParser.class.getCanonicalName())); } @Test - public void testNotReusableCache() throws Exception{ - LinkExtractorParser parser = BaseParser - .getParser(NotReusableParser.class.getCanonicalName()); - assertNotSame(parser, BaseParser.getParser(NotReusableParser.class - .getCanonicalName())); + public void testNotReusableCache() throws Exception { + assertNotSame( + BaseParser.getParser(NotReusableParser.class.getCanonicalName()), + BaseParser.getParser(NotReusableParser.class.getCanonicalName())); } } Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java Wed Dec 6 22:21:19 2017 @@ -300,9 +300,7 @@ public class TestHTMLParser extends JMet BaseParser.getParser("no.such.parser"); fail("Should not have been able to create the parser"); } catch (LinkExtractorParseException e) { - if (e.getCause() instanceof ClassNotFoundException) { - // This is OK - } else { + if (!(e.getCause() instanceof ClassNotFoundException)) { throw e; } } Modified: jmeter/trunk/test/src/org/apache/jmeter/report/dashboard/ApdexPerTransactionTest.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/dashboard/ApdexPerTransactionTest.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/report/dashboard/ApdexPerTransactionTest.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/report/dashboard/ApdexPerTransactionTest.java Wed Dec 6 22:21:19 2017 @@ -34,25 +34,25 @@ import org.junit.Test; import jodd.props.Props; public class ApdexPerTransactionTest extends JMeterTestCase { - - // prop in the file mixes comma, semicolon and spans several lines. - // it also includes hardcoded sample names mixed with regexes - private static final String apdexString = "sample(\\d+):1000|2000;samples12:3000|4000;scenar01-12:5000|6000"; - - @Test - public void testgetApdexPerTransactionProperty() throws Exception { - final Props props = new Props(); - final String REPORT_GENERATOR_KEY_PREFIX = "jmeter.reportgenerator"; - final char KEY_DELIMITER = '.'; - final String REPORT_GENERATOR_KEY_APDEX_PER_TRANSACTION = REPORT_GENERATOR_KEY_PREFIX - + KEY_DELIMITER + "apdex_per_transaction"; - - props.load(this.getClass().getResourceAsStream("reportgenerator_test.properties")); - final String apdexPerTransaction = getOptionalProperty(props, - REPORT_GENERATOR_KEY_APDEX_PER_TRANSACTION); - assertEquals(apdexString, apdexPerTransaction); - } - + + // prop in the file mixes comma, semicolon and spans several lines. + // it also includes hardcoded sample names mixed with regexes + private static final String apdexString = "sample(\\d+):1000|2000;samples12:3000|4000;scenar01-12:5000|6000"; + + @Test + public void testgetApdexPerTransactionProperty() throws Exception { + final Props props = new Props(); + final String REPORT_GENERATOR_KEY_PREFIX = "jmeter.reportgenerator"; + final char KEY_DELIMITER = '.'; + final String REPORT_GENERATOR_KEY_APDEX_PER_TRANSACTION = REPORT_GENERATOR_KEY_PREFIX + + KEY_DELIMITER + "apdex_per_transaction"; + + props.load(this.getClass().getResourceAsStream("reportgenerator_test.properties")); + final String apdexPerTransaction = getOptionalProperty(props, + REPORT_GENERATOR_KEY_APDEX_PER_TRANSACTION); + assertEquals(apdexString, apdexPerTransaction); + } + @Test public void testgetApdexPerTransactionPropertySimple() throws Exception { final Props props = new Props(); @@ -62,17 +62,17 @@ public class ApdexPerTransactionTest ext assertNotNull("title should not be null", title); } - @Test - public void testGetApdexPerTransactionParts() { - Map<String, Long[]> apdex = ReportGeneratorConfiguration.getApdexPerTransactionParts(apdexString); - assertNotNull("map should not be null", apdex); - assertEquals(3, apdex.size()); - Set<String> keys = apdex.keySet(); - assertTrue(keys.contains("samples12")); - assertTrue(keys.contains("scenar01-12")); - assertTrue(keys.contains("sample(\\d+)")); - assertArrayEquals(new Long[] {1000L, 2000L}, apdex.get("sample(\\d+)")); - } + @Test + public void testGetApdexPerTransactionParts() { + Map<String, Long[]> apdex = ReportGeneratorConfiguration.getApdexPerTransactionParts(apdexString); + assertNotNull("map should not be null", apdex); + assertEquals(3, apdex.size()); + Set<String> keys = apdex.keySet(); + assertTrue(keys.contains("samples12")); + assertTrue(keys.contains("scenar01-12")); + assertTrue(keys.contains("sample(\\d+)")); + assertArrayEquals(new Long[] {1000L, 2000L}, apdex.get("sample(\\d+)")); + } @Test public void testGetApdexPerTransactionPartsOneCustomization() { @@ -102,38 +102,38 @@ public class ApdexPerTransactionTest ext assertNotNull("map should not be null", apdex); assertEquals(0, apdex.size()); } - - @Test - public void testSampleNameMatching() { - /* matching pairs : - * sample(\d+) sample2 - * sample(\d+) sample12 - * scenar01-12 scenar01-12 - * samples12 samples12 - * */ - - String[] sampleNames = {"sample2","sample12", "scenar01-12", "samples12"}; - - Map<String, Long[]> apdex = ReportGeneratorConfiguration.getApdexPerTransactionParts(apdexString); - for (String sampleName : sampleNames) { - boolean hasMatched = false; - for (Map.Entry<String, Long[]> entry : apdex.entrySet()) { - org.apache.oro.text.regex.Pattern regex = JMeterUtils.getPatternCache().getPattern(entry.getKey()); - PatternMatcher matcher = JMeterUtils.getMatcher(); - if(matcher.matches(sampleName, regex)) { - hasMatched= true; - } - } - assertTrue(hasMatched); - } - - } - - private static String getOptionalProperty(Props props, String key) { + + @Test + public void testSampleNameMatching() { + /* matching pairs : + * sample(\d+) sample2 + * sample(\d+) sample12 + * scenar01-12 scenar01-12 + * samples12 samples12 + * */ + + String[] sampleNames = {"sample2","sample12", "scenar01-12", "samples12"}; + + Map<String, Long[]> apdex = ReportGeneratorConfiguration.getApdexPerTransactionParts(apdexString); + for (String sampleName : sampleNames) { + boolean hasMatched = false; + for (Map.Entry<String, Long[]> entry : apdex.entrySet()) { + org.apache.oro.text.regex.Pattern regex = JMeterUtils.getPatternCache().getPattern(entry.getKey()); + PatternMatcher matcher = JMeterUtils.getMatcher(); + if(matcher.matches(sampleName, regex)) { + hasMatched= true; + } + } + assertTrue(hasMatched); + } + + } + + private static String getOptionalProperty(Props props, String key) { return getProperty(props, key, null); } - - private static String getProperty(Props props, String key, String defaultValue) { + + private static String getProperty(Props props, String key, String defaultValue) { String value = props.getValue(key); if (value == null) { return defaultValue; Modified: jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java Wed Dec 6 22:21:19 2017 @@ -42,13 +42,13 @@ import java.util.concurrent.atomic.Atomi import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.jmeter.gui.util.JMeterMenuBar; +import org.apache.jorphan.util.JOrphanUtils; + import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.jmeter.gui.util.JMeterMenuBar; -import org.apache.jorphan.util.JOrphanUtils; - /* * Created on Nov 29, 2003 * @@ -344,14 +344,6 @@ public class PackageTest extends TestCas assertEquals(missingLabelsPerBundle.size()+" missing labels, labels missing:"+printLabels(missingLabelsPerBundle), 0, missingLabelsPerBundle.size()); } - /** - * Check messages are available in language - * @param missingLabelsPerBundle2 - * @param missingLabelsPerBundle - * @param messages Properties messages in english - * @param language Language - * @throws IOException - */ private void checkMessagesForLanguage(Map<String, Map<String, String>> missingLabelsPerBundle, Map<String, Map<String, String>> missingLabelsPerBundle2, Properties messages, String bundlePath,String language) throws IOException { Properties messagesFr = new Properties(); @@ -375,7 +367,7 @@ public class PackageTest extends TestCas String value = (String) entry.getValue(); // TODO improve check of values that don't need translation if (value.matches(I18NString)) { - // System.out.println("Ignoring missing "+key+"="+value+" in "+languageBundle); // TODO convert to list and display at end + System.out.println("Ignoring missing " + key + "=" + value + " in " + languageBundle); // TODO convert to list and display at end } else { missingLabels.put(key, (String) entry.getValue()); } @@ -391,12 +383,6 @@ public class PackageTest extends TestCas } } - /** - * Build message with missing labels per bundle. - * - * @param missingLabelsPerBundle - * @return String - */ private String printLabels(Map<String, Map<String, String>> missingLabelsPerBundle) { StringBuilder builder = new StringBuilder(); for (Map.Entry<String, Map<String, String>> entry : missingLabelsPerBundle.entrySet()) { Modified: jmeter/trunk/test/src/org/apache/jmeter/resources/TestPropertiesFiles.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/resources/TestPropertiesFiles.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/resources/TestPropertiesFiles.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/resources/TestPropertiesFiles.java Wed Dec 6 22:21:19 2017 @@ -18,6 +18,9 @@ package org.apache.jmeter.resources; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.io.File; import java.io.FileInputStream; import java.util.Enumeration; @@ -25,12 +28,10 @@ import java.util.Properties; import org.apache.jmeter.junit.JMeterTestCase; import org.apache.jmeter.util.JMeterUtils; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; import org.junit.Test; public class TestPropertiesFiles extends JMeterTestCase { - + @Test public void testUserProperties() throws Exception { @@ -43,26 +44,22 @@ public class TestPropertiesFiles extends public void testDefaultProperties() throws Exception { Properties jmeter = loadProps(new File(JMeterUtils.getJMeterBinDir(), "jmeter.properties")); Properties report = loadProps(new File(JMeterUtils.getJMeterBinDir(), "reportgenerator.properties")); - { - Enumeration<?> names = jmeter.propertyNames(); - while(names.hasMoreElements()) { - final Object key = names.nextElement(); - assertFalse("reportgenerator should not contain the jmeter key " + key, report.containsKey(key)); - } + Enumeration<?> jmeterNames = jmeter.propertyNames(); + while (jmeterNames.hasMoreElements()) { + final Object key = jmeterNames.nextElement(); + assertFalse("reportgenerator should not contain the jmeter key " + key, report.containsKey(key)); } - { - Enumeration<?> names = report.propertyNames(); - while(names.hasMoreElements()) { - final Object key = names.nextElement(); - assertFalse("jmeter should not contain the reportgenerator key " + key, jmeter.containsKey(key)); - } + Enumeration<?> reportNames = report.propertyNames(); + while (reportNames.hasMoreElements()) { + final Object key = reportNames.nextElement(); + assertFalse("jmeter should not contain the reportgenerator key " + key, jmeter.containsKey(key)); } } - private static Properties loadProps(File file) throws Exception{ + private static Properties loadProps(File file) throws Exception { Properties props = new Properties(); - try (FileInputStream inStream = new FileInputStream(file)){ - props.load(inStream); + try (FileInputStream inStream = new FileInputStream(file)) { + props.load(inStream); } return props; } Modified: jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java Wed Dec 6 22:21:19 2017 @@ -39,7 +39,9 @@ public interface ResourceLocator { public static Path getResourcePath(Class<?> basetype, String path) { URL url = basetype.getResource(path); - if (url == null) return null; + if (url == null) { + return null; + } Path nioPath; try { nioPath = Paths.get(url.toURI()); Modified: jmeter/trunk/test/src/org/apache/jmeter/testelement/TestNumberProperty.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testelement/TestNumberProperty.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/testelement/TestNumberProperty.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/testelement/TestNumberProperty.java Wed Dec 6 22:21:19 2017 @@ -18,7 +18,7 @@ package org.apache.jmeter.testelement; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import org.apache.jmeter.testelement.property.DoubleProperty; import org.apache.jmeter.testelement.property.IntegerProperty; Modified: jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java Wed Dec 6 22:21:19 2017 @@ -18,7 +18,7 @@ package org.apache.jmeter.util; -import static org.junit.Assert.*; +import static org.junit.Assert.assertThat; import java.io.PrintStream; Modified: jmeter/trunk/test/src/org/apache/jmeter/visualizers/TestSampleCompareTo.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/visualizers/TestSampleCompareTo.java?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/visualizers/TestSampleCompareTo.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/visualizers/TestSampleCompareTo.java Wed Dec 6 22:21:19 2017 @@ -18,7 +18,7 @@ package org.apache.jmeter.visualizers; -import static org.junit.Assert.*; +import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.Collection; @@ -59,7 +59,7 @@ public class TestSampleCompareTo { } private Sample sample(long count) { - return new Sample("dummy", 0l, 0L, 0L, 0L, 0L, 0.0, 0L, true, count, 0L); + return new Sample("dummy", 0L, 0L, 0L, 0L, 0L, 0.0, 0L, true, count, 0L); } } Modified: jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1817321&r1=1817320&r2=1817321&view=diff ============================================================================== --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) +++ jmeter/trunk/xdocs/changes.xml [utf-8] Wed Dec 6 22:21:19 2017 @@ -195,11 +195,12 @@ Summary <li><pr>319</pr>Removed commented out code. Contributed by Graham Russell (graham at ham1.co.uk)</li> <li><pr>322</pr>General JavaDoc cleanup. Contributed by Graham Russell (graham at ham1.co.uk)</li> <li><pr>323</pr>Extracted method and used streams to improve readability. Contributed by Graham Russell (graham at ham1.co.uk)</li> - <li><pr>324</pr> Save backup refactor. Contributed by Graham Russell (graham at ham1.co.uk)</li> - <li><pr>327</pr> Utilising more modern Java, simplifying code and formatting code and comments. Contributed by Graham Russell (graham at ham1.co.uk)</li> + <li><pr>324</pr>Save backup refactor. Contributed by Graham Russell (graham at ham1.co.uk)</li> + <li><pr>327</pr>Utilising more modern Java, simplifying code and formatting code and comments. Contributed by Graham Russell (graham at ham1.co.uk)</li> <li><pr>332</pr>Add the spock framework for groovy unit tests. Contributed by Graham Russell (graham at ham1.co.uk)</li> - <li><pr>334</pr> Enable running of JUnit tests from within IntelliJ with default config. Contributed by Graham Russell (graham at ham1.co.uk)</li> - <li><pr>335</pr> Removed <code>functions.util.*</code> as they don't seem to be used (for many years). Contributed by Graham Russell (graham at ham1.co.uk)</li> + <li><pr>334</pr>Enable running of JUnit tests from within IntelliJ with default config. Contributed by Graham Russell (graham at ham1.co.uk)</li> + <li><pr>335</pr>Removed <code>functions.util.*</code> as they don't seem to be used (for many years). Contributed by Graham Russell (graham at ham1.co.uk)</li> + <li><pr>345</pr>Updated to latest checkstyle (v8.5), Added many more rules to checkstyle, Included checking of test files and more file types. Contributed by Graham Russell (graham at ham1.co.uk)</li> </ul> <!-- =================== Bug fixes =================== -->
