Author: fschumacher Date: Mon Feb 12 10:48:11 2018 New Revision: 1823940 URL: http://svn.apache.org/viewvc?rev=1823940&view=rev Log: Get down to a maximum length of 165 chars
Part of #358 on github. Based on contribution by Graham Russell (graham at ham1.co.uk) Modified: jmeter/trunk/checkstyle.xml jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java jmeter/trunk/src/jorphan/org/apache/jorphan/exec/SystemCommand.java jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java jmeter/trunk/test/src/org/apache/jmeter/assertions/TestJSONPathAssertion.java jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java Modified: jmeter/trunk/checkstyle.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/checkstyle.xml?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/checkstyle.xml (original) +++ jmeter/trunk/checkstyle.xml Mon Feb 12 10:48:11 2018 @@ -170,7 +170,7 @@ </module> <module name="LineLength"> <!-- TODO: reduce this to 120 --> - <property name="max" value="170"/> + <property name="max" value="165"/> </module> <!-- whitespace --> Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java (original) +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java Mon Feb 12 10:48:11 2018 @@ -332,10 +332,20 @@ public abstract class SamplerResultTab i setupTabPaneForAssertionResult(); StringBuilder statsBuff = new StringBuilder(100); - statsBuff.append(JMeterUtils.getResString("view_results_assertion_error")).append(assertionResult.isError()).append(NL); //$NON-NLS-1$ - statsBuff.append(JMeterUtils.getResString("view_results_assertion_failure")).append(assertionResult.isFailure()).append(NL); //$NON-NLS-1$ - statsBuff.append(JMeterUtils.getResString("view_results_assertion_failure_message")).append(assertionResult.getFailureMessage()).append(NL); //$NON-NLS-1$ - statsDoc.insertString(statsDoc.getLength(), statsBuff.toString(), null); + statsBuff + .append(JMeterUtils + .getResString("view_results_assertion_error")) //$NON-NLS-1$ + .append(assertionResult.isError()).append(NL); + statsBuff + .append(JMeterUtils + .getResString("view_results_assertion_failure")) //$NON-NLS-1$ + .append(assertionResult.isFailure()).append(NL); + statsBuff + .append(JMeterUtils.getResString( + "view_results_assertion_failure_message")) //$NON-NLS-1$ + .append(assertionResult.getFailureMessage()).append(NL); + statsDoc.insertString(statsDoc.getLength(), + statsBuff.toString(), null); } stats.setCaretPosition(1); } catch (BadLocationException exc) { Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java (original) +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java Mon Feb 12 10:48:11 2018 @@ -245,7 +245,8 @@ public class BackendListenerGui extends classnameCombo.setSelectedItem(className); } else { log.error( - "Error setting class: '{}' in BackendListener: {}, check for a missing jar in your jmeter 'search_paths' and 'plugin_dependency_paths' properties", + "Error setting class: '{}' in BackendListener: {}, check for a missing jar in" + + "your jmeter 'search_paths' and 'plugin_dependency_paths' properties", className, getName()); } queueSize.setText(((BackendListener)config).getQueueSize()); Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java Mon Feb 12 10:48:11 2018 @@ -62,7 +62,8 @@ public final class RemoteJMeterEngineImp private Properties remotelySetProperties; private RemoteJMeterEngineImpl(int localPort, int rmiRegistryPort) throws RemoteException { - super(localPort, RmiUtils.createClientSocketFactory(), RmiUtils.createServerSocketFactory()); // Create this object using the specified port (0 means anonymous) + // Create this object using the specified port (0 means anonymous) + super(localPort, RmiUtils.createClientSocketFactory(), RmiUtils.createServerSocketFactory()); this.rmiRegistryPort = rmiRegistryPort; System.out.println("Created remote object: "+this.getRef().remoteToString()); } @@ -229,7 +230,7 @@ public final class RemoteJMeterEngineImp * @throws IllegalStateException if the caller is not the owner. */ private void checkOwner(String methodName) { - if (ownerThread != null && ownerThread != Thread.currentThread()){ + if (ownerThread != null && ownerThread != Thread.currentThread()) { String msg = "The engine is not owned by this thread - cannot call "+methodName; log.warn(msg); throw new IllegalStateException(msg); Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java Mon Feb 12 10:48:11 2018 @@ -78,8 +78,11 @@ public class ReportGenerator { private static final char CSV_DEFAULT_SEPARATOR = // We cannot use JMeterUtils#getPropDefault as it applies a trim on value - JMeterUtils.getDelimiter( - JMeterUtils.getJMeterProperties().getProperty(SampleSaveConfiguration.DEFAULT_DELIMITER_PROP, SampleSaveConfiguration.DEFAULT_DELIMITER)).charAt(0); + JMeterUtils + .getDelimiter(JMeterUtils.getJMeterProperties().getProperty( + SampleSaveConfiguration.DEFAULT_DELIMITER_PROP, + SampleSaveConfiguration.DEFAULT_DELIMITER)) + .charAt(0); private static final String INVALID_CLASS_FMT = "Class name \"%s\" is not valid."; private static final String INVALID_EXPORT_FMT = "Data exporter \"%s\" is unable to export data."; Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/exec/SystemCommand.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/exec/SystemCommand.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/jorphan/org/apache/jorphan/exec/SystemCommand.java (original) +++ jmeter/trunk/src/jorphan/org/apache/jorphan/exec/SystemCommand.java Mon Feb 12 10:48:11 2018 @@ -67,7 +67,8 @@ public class SystemCommand { * @param stderr File name that will contain err stream (may be null) * @throws IOException if the input file is not found or output cannot be written */ - public SystemCommand(File directory, long timeoutMillis, int pollInterval, Map<String, String> env, String stdin, String stdout, String stderr) throws IOException { + public SystemCommand(File directory, long timeoutMillis, int pollInterval, Map<String, String> env, + String stdin, String stdout, String stderr) throws IOException { this(directory, timeoutMillis, pollInterval, env, checkIn(stdin), checkOut(stdout), checkOut(stderr)); } @@ -99,7 +100,8 @@ public class SystemCommand { * @param stdout File name that will contain out stream (may be null) * @param stderr File name that will contain err stream (may be null) */ - public SystemCommand(File directory, long timeoutMillis, int pollInterval, Map<String, String> env, InputStream stdin, OutputStream stdout, OutputStream stderr) { + public SystemCommand(File directory, long timeoutMillis, int pollInterval, Map<String, String> env, + InputStream stdin, OutputStream stdout, OutputStream stderr) { super(); this.timeoutMillis = timeoutMillis; this.directory = directory; @@ -126,7 +128,8 @@ public class SystemCommand { } // helper method to allow input and output to be changed for chaining - private int run(List<String> arguments, InputStream in, OutputStream out, OutputStream err) throws InterruptedException, IOException { + private int run(List<String> arguments, InputStream in, + OutputStream out,OutputStream err) throws InterruptedException, IOException { Process proc = null; final ProcessBuilder procBuild = new ProcessBuilder(arguments); if (env != null) { Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java Mon Feb 12 10:48:11 2018 @@ -153,7 +153,10 @@ public class MultipartUrlConfig implemen private String getHeaderValue(String headerName, String multiPart) { String regularExpression = headerName + "\\s*:\\s*(.*)$"; //$NON-NLS-1$ Perl5Matcher localMatcher = JMeterUtils.getMatcher(); - Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); + Pattern pattern = JMeterUtils.getPattern(regularExpression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.MULTILINE_MASK); if(localMatcher.contains(multiPart, pattern)) { return localMatcher.getMatch().group(1).trim(); } Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java Mon Feb 12 10:48:11 2018 @@ -297,7 +297,10 @@ public class HttpMirrorThread implements Perl5Matcher localMatcher = JMeterUtils.getMatcher(); // We use multi-line mask so can prefix the line with ^ String expression = "^" + headerName + ":\\s+([^\\r\\n]+)"; // $NON-NLS-1$ $NON-NLS-2$ - Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); + Pattern pattern = JMeterUtils.getPattern(expression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.MULTILINE_MASK); if(localMatcher.contains(requestHeaders, pattern)) { // The value is in the first group, group 0 is the whole match return localMatcher.getMatch().group(1); @@ -311,7 +314,10 @@ public class HttpMirrorThread implements Perl5Matcher localMatcher = JMeterUtils.getMatcher(); // The headers and body are divided by a blank line (the \r is to allow for the CR before LF) String regularExpression = "^\\r$"; // $NON-NLS-1$ - Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); + Pattern pattern = JMeterUtils.getPattern(regularExpression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.MULTILINE_MASK); PatternMatcherInput input = new PatternMatcherInput(stringToCheck); if(localMatcher.contains(input, pattern)) { Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (original) +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java Mon Feb 12 10:48:11 2018 @@ -252,10 +252,14 @@ public class ProxyControl extends Generi KEYSTORE_MODE = KeystoreMode.NONE; } else if (USE_DYNAMIC_KEYS) { KEYSTORE_MODE = KeystoreMode.DYNAMIC_KEYSTORE; - log.info("HTTP(S) Test Script Recorder SSL Proxy will use keys that support embedded 3rd party resources in file " + CERT_PATH_ABS); + log.info( + "HTTP(S) Test Script Recorder SSL Proxy will use keys that support embedded 3rd party resources in file " + + CERT_PATH_ABS); } else { KEYSTORE_MODE = KeystoreMode.JMETER_KEYSTORE; - log.warn("HTTP(S) Test Script Recorder SSL Proxy will use keys that may not work for embedded resources in file " + CERT_PATH_ABS); + log.warn( + "HTTP(S) Test Script Recorder SSL Proxy will use keys that may not work for embedded resources in file " + + CERT_PATH_ABS); } } } @@ -630,9 +634,11 @@ public class ProxyControl extends Generi if (filterContentType(result) && filterUrl(sampler)) { JMeterTreeNode myTarget = findTargetControllerNode(); @SuppressWarnings("unchecked") // OK, because find only returns correct element types - Collection<ConfigTestElement> defaultConfigurations = (Collection<ConfigTestElement>) findApplicableElements(myTarget, ConfigTestElement.class, false); + Collection<ConfigTestElement> defaultConfigurations = (Collection<ConfigTestElement>) findApplicableElements( + myTarget, ConfigTestElement.class, false); @SuppressWarnings("unchecked") // OK, because find only returns correct element types - Collection<Arguments> userDefinedVariables = (Collection<Arguments>) findApplicableElements(myTarget, Arguments.class, true); + Collection<Arguments> userDefinedVariables = (Collection<Arguments>) findApplicableElements( + myTarget, Arguments.class, true); removeValuesFromSampler(sampler, defaultConfigurations); replaceValues(sampler, testElements, userDefinedVariables); @@ -657,7 +663,10 @@ public class ProxyControl extends Generi // SampleEvent is not passed JMeterVariables, because they don't make sense for Proxy Recording notifySampleListeners(new SampleEvent(result, "WorkBench")); } else { - log.debug("Sample not delivered to Child Sampler Listener based on url or content-type: " + result.getUrlAsString() + " - " + result.getContentType()); + log.debug( + "Sample not delivered to Child Sampler Listener based on url or content-type: " + + result.getUrlAsString() + " - " + + result.getContentType()); } } @@ -1511,20 +1520,31 @@ public class ProxyControl extends Generi } } catch (CertificateExpiredException e) { keyStore = null; // if cert is not valid, flag up to recreate it - log.warn("Existing ROOT Certificate has expired, a new one will be created, ensure you install it in browser, message: " + e.getMessage(), e); + log.warn( + "Existing ROOT Certificate has expired, a new one will be created, ensure you install it in browser, message: " + + e.getMessage(), + e); } catch (CertificateNotYetValidException e) { keyStore = null; // if cert is not valid, flag up to recreate it - log.warn("Existing ROOT Certificate is not yet valid, a new one will be created, ensure you install it in browser, message: " + e.getMessage(), e); + log.warn( + "Existing ROOT Certificate is not yet valid, a new one will be created, ensure you install it in browser, message: " + + e.getMessage(), + e); } catch (GeneralSecurityException e) { keyStore = null; // if cert is not valid, flag up to recreate it - log.warn("Problem reading key store, a new one will be created, ensure you install it in browser, message: " + e.getMessage(), e); + log.warn( + "Problem reading key store, a new one will be created, ensure you install it in browser, message: " + + e.getMessage(), + e); } } if (keyStore == null) { // no existing file or not valid storePassword = RandomStringUtils.randomAlphanumeric(20); // Alphanum to avoid issues with command-line quoting keyPassword = storePassword; // we use same password for both setPassword(storePassword); - log.info("Creating HTTP(S) Test Script Recorder Root CA in " + CERT_PATH_ABS+", ensure you install certificate in your Browser for recording"); + log.info("Creating HTTP(S) Test Script Recorder Root CA in " + + CERT_PATH_ABS + + ", ensure you install certificate in your Browser for recording"); KeyToolUtils.generateProxyCA(CERT_PATH, storePassword, CERT_VALIDITY); log.info("Created keystore in " + CERT_PATH_ABS); keyStore = getKeyStore(storePassword.toCharArray()); // This should now work @@ -1587,7 +1607,8 @@ public class ProxyControl extends Generi setPassword(storePassword); log.info("Generating standard keypair in " + CERT_PATH_ABS); if(!CERT_PATH.delete()){ // safer to start afresh - log.warn("Could not delete "+CERT_PATH.getAbsolutePath()+", this could create issues, stop jmeter, ensure file is deleted and restart again"); + log.warn("Could not delete " + CERT_PATH.getAbsolutePath() + + ", this could create issues, stop jmeter, ensure file is deleted and restart again"); } KeyToolUtils.genkeypair(CERT_PATH, JMETER_SERVER_ALIAS, storePassword, CERT_VALIDITY, null, null); keyStore = getKeyStore(storePassword.toCharArray()); // This should now work Modified: jmeter/trunk/test/src/org/apache/jmeter/assertions/TestJSONPathAssertion.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/assertions/TestJSONPathAssertion.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/assertions/TestJSONPathAssertion.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/assertions/TestJSONPathAssertion.java Mon Feb 12 10:48:11 2018 @@ -329,7 +329,9 @@ public class TestJSONPathAssertion { AssertionResult result = instance.getResult(samplerResult); assertEquals(expResult.getName(), result.getName()); assertEquals(true, result.isFailure()); - assertEquals("Value expected to match regexp '{headerkey=header value}', but it did not match: '{\"headerkey\":\"header value\"}'", result.getFailureMessage()); + assertEquals( + "Value expected to match regexp '{headerkey=header value}', but it did not match: '{\"headerkey\":\"header value\"}'", + result.getFailureMessage()); } @Test 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=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestDigestFunction.java Mon Feb 12 10:48:11 2018 @@ -38,7 +38,7 @@ import org.junit.Test; * */ public class TestDigestFunction extends JMeterTestCase { - protected AbstractFunction digest; + protected AbstractFunction digest; private SampleResult result; @@ -74,7 +74,9 @@ public class TestDigestFunction extends params.add(new CompoundVariable("salt")); digest.setParameters(params); String returnValue = digest.execute(result, null); - assertEquals("abc8c7a1c814c74d5882e527d21fabfccf480716df9d17bae73e5e767992d8a2a47033459a9ea91aca3186f75bfbe559419109bc44c1e6dfd618101fdc0beb1b", returnValue); + assertEquals( + "abc8c7a1c814c74d5882e527d21fabfccf480716df9d17bae73e5e767992d8a2a47033459a9ea91aca3186f75bfbe559419109bc44c1e6dfd618101fdc0beb1b", + returnValue); } @Test @@ -84,7 +86,9 @@ public class TestDigestFunction extends params.add(new CompoundVariable("salt ")); digest.setParameters(params); String returnValue = digest.execute(result, null); - assertEquals("961451eb5870ded3fa484ad49fd1481ae3c6decdcc560200e70624a1d62ad0d1793edf3c8eccd0786bffab0b3e4421f54c7fd11a9e7461580352346d039b8e16", returnValue); + assertEquals( + "961451eb5870ded3fa484ad49fd1481ae3c6decdcc560200e70624a1d62ad0d1793edf3c8eccd0786bffab0b3e4421f54c7fd11a9e7461580352346d039b8e16", + returnValue); } @Test @@ -94,13 +98,15 @@ public class TestDigestFunction extends params.add(new CompoundVariable("salt ")); digest.setParameters(params); String returnValue = digest.execute(result, null); - assertEquals("3968fd028934466fa095f6323c527148e87d7b74601d1db5f474748dd7c643b4f508e46beb29a405ec658a64c0f581461e99eca063414099af0b63dc890b5739", returnValue); + assertEquals( + "3968fd028934466fa095f6323c527148e87d7b74601d1db5f474748dd7c643b4f508e46beb29a405ec658a64c0f581461e99eca063414099af0b63dc890b5739", + returnValue); } @Test public void testSha1() throws Exception { - params.add(new CompoundVariable("SHA-1")); - params.add(new CompoundVariable("nofile")); + params.add(new CompoundVariable("SHA-1")); + params.add(new CompoundVariable("nofile")); digest.setParameters(params); String returnValue = digest.execute(result, null); assertEquals("4ea2ced10057872be25371cfe638d3b096c58f2f", returnValue); @@ -108,38 +114,40 @@ public class TestDigestFunction extends @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("SHA-1")); + params.add(new CompoundVariable("nofile")); + params.add(new CompoundVariable("")); params.add(new CompoundVariable("true")); - params.add(new CompoundVariable("newVar")); + params.add(new CompoundVariable("newVar")); digest.setParameters(params); String returnValue = digest.execute(result, null); assertEquals("4EA2CED10057872BE25371CFE638D3B096C58F2F", returnValue); } @Test - public void testSha512Variable() throws Exception { + public void testSha512Variable() throws Exception { params.add(new CompoundVariable("SHA-512")); - params.add(new CompoundVariable("nofile")); + 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); + assertEquals( + "58DA94D45A97B35B31D7F76D2EBAC184BC4BDA512B966CDBE43FDE1CAE1CFAF89617082CA89928FB5DC1C75D60B93ADB5631F518F970CA6DCC196E1AFC678B8C", + returnValue); } @Test(expected=InvalidVariableException.class) public void testSha512Error() throws Exception { - params.add(new CompoundVariable("nofile")); + 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")); + params.add(new CompoundVariable("SHA-1")); digest.setParameters(params); digest.execute(result, null); } Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java Mon Feb 12 10:48:11 2018 @@ -77,7 +77,11 @@ public class TestCacheManagerUrlConnecti } private static void checkProperty(Map<String, List<String>> properties, String property, String expectedPropertyValue) { - assertNotNull("Properties should not be null. Expected to find within it property = " + property + " with expected value = " + expectedPropertyValue, properties); + assertNotNull( + "Properties should not be null. Expected to find within it property = " + + property + " with expected value = " + + expectedPropertyValue, + properties); List<String> listOfPropertyValues = properties.get(property); assertNotNull("No property entry found for property " + property, listOfPropertyValues); assertEquals("Did not find single property for property " + property, 1, listOfPropertyValues.size()); Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java Mon Feb 12 10:48:11 2018 @@ -329,7 +329,9 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeMultipart(connection, PostWriter.BOUNDARY); - byte[] expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, null, titleField, titleValue, descriptionField, descriptionValue, true, true); + byte[] expectedFormBody = createExpectedFormdataOutput( + PostWriter.BOUNDARY, null, titleField, titleValue, + descriptionField, descriptionValue, true, true); checkContentLength(connection, expectedFormBody.length); checkArraysHaveSameContent(expectedFormBody, connection.getOutputStreamContent()); connection.disconnect(); @@ -342,7 +344,9 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeMultipart(connection, PostWriter.BOUNDARY); - expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, true); + expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, true); checkContentLength(connection, expectedFormBody.length); checkArraysHaveSameContent(expectedFormBody, connection.getOutputStreamContent()); connection.disconnect(); @@ -358,7 +362,9 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeMultipart(connection, PostWriter.BOUNDARY); - expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, true); + expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, true); checkContentLength(connection, expectedFormBody.length); checkArraysHaveSameContent(expectedFormBody, connection.getOutputStreamContent()); connection.disconnect(); @@ -374,7 +380,9 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeMultipart(connection, PostWriter.BOUNDARY); - expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, true); + expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, true); checkContentLength(connection, expectedFormBody.length); checkArraysHaveSameContent(expectedFormBody, connection.getOutputStreamContent()); connection.disconnect(); @@ -391,7 +399,9 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeMultipart(connection, PostWriter.BOUNDARY); - expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, true); + expectedFormBody = createExpectedFormdataOutput(PostWriter.BOUNDARY, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, true); checkContentLength(connection, expectedFormBody.length); checkArraysHaveSameContent(expectedFormBody, connection.getOutputStreamContent()); connection.disconnect(); @@ -450,7 +460,10 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeUrlEncoded(connection); - String expectedString = "title=" + URLEncoder.encode(titleValue, contentEncoding) + "&description=" + URLEncoder.encode(descriptionValue, contentEncoding); + String expectedString = "title=" + + URLEncoder.encode(titleValue, contentEncoding) + + "&description=" + + URLEncoder.encode(descriptionValue, contentEncoding); expectedUrl = expectedString.getBytes(contentEncoding); checkContentLength(connection, expectedUrl.length); checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent()); @@ -473,7 +486,10 @@ public class PostWriterTest { postWriter.sendPostData(connection, sampler); checkContentTypeUrlEncoded(connection); - expectedString = "title=" + URLEncoder.encode(titleValue, contentEncoding) + "&description=" + URLEncoder.encode(descriptionValue, contentEncoding); + expectedString = "title=" + + URLEncoder.encode(titleValue, contentEncoding) + + "&description=" + + URLEncoder.encode(descriptionValue, contentEncoding); expectedUrl = expectedString.getBytes("US-ASCII"); checkContentLength(connection, expectedUrl.length); checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent()); @@ -558,7 +574,10 @@ public class PostWriterTest { checkContentTypeUrlEncoded(connection); sb = new StringBuilder(); - expectedUrl = sb.append("title=").append(titleValue.replaceAll("%20", "+")).append("&description=").append(descriptionValue).toString().getBytes("US-ASCII"); + expectedUrl = sb.append("title=") + .append(titleValue.replaceAll("%20", "+")) + .append("&description=").append(descriptionValue).toString() + .getBytes("US-ASCII"); checkContentLength(connection, expectedUrl.length); checkArraysHaveSameContent(expectedUrl, connection.getOutputStreamContent()); assertEquals( @@ -684,8 +703,12 @@ public class PostWriterTest { String fileField, byte[] fileContent) throws IOException { // Create the multiparts - byte[] formdataMultipart = createExpectedFormdataOutput(boundaryString, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, false); - byte[] fileMultipart = createExpectedFilepartOutput(boundaryString, fileField, temporaryFile, "text/plain", fileContent, false, true); + byte[] formdataMultipart = createExpectedFormdataOutput(boundaryString, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, false); + byte[] fileMultipart = createExpectedFilepartOutput(boundaryString, + fileField, temporaryFile, "text/plain", fileContent, false, + true); // Join the two multiparts ByteArrayOutputStream output = new ByteArrayOutputStream(); Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java?rev=1823940&r1=1823939&r2=1823940&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java (original) +++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java Mon Feb 12 10:48:11 2018 @@ -101,7 +101,8 @@ public class TestHTTPSamplersAgainstHttp protected void setUp() throws Exception { httpServer = TestHTTPMirrorThread.startHttpMirror(MIRROR_PORT); // Create the test file content - TEST_FILE_CONTENT = "some foo content &?=01234+56789-\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85".getBytes("UTF-8"); + TEST_FILE_CONTENT = "some foo content &?=01234+56789-\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85" + .getBytes("UTF-8"); // create a temporary file to make sure we always have a file to give to the PostWriter // Whereever we are or Whatever the current path is. @@ -192,7 +193,9 @@ public class TestHTTPSamplersAgainstHttp setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); res = executeSampler(sampler); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, false); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, false); break; case 1: // Test sending data as ISO-8859-1 @@ -200,7 +203,9 @@ public class TestHTTPSamplersAgainstHttp setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); res = executeSampler(sampler); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, false); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, false); break; case 2: // Test sending data as UTF-8 @@ -210,7 +215,9 @@ public class TestHTTPSamplersAgainstHttp setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); res = executeSampler(sampler); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, false); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, false); break; case 3: // Test sending data as UTF-8, with values that will change when urlencoded @@ -220,7 +227,9 @@ public class TestHTTPSamplersAgainstHttp setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); res = executeSampler(sampler); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, false); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, false); break; case 4: // Test sending data as UTF-8, with values that have been urlencoded @@ -230,7 +239,9 @@ public class TestHTTPSamplersAgainstHttp setupUrl(sampler, contentEncoding); setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue); res = executeSampler(sampler); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true); break; case 5: // Test sending data as UTF-8, with values similar to __VIEWSTATE parameter that .net uses @@ -240,7 +251,9 @@ public class TestHTTPSamplersAgainstHttp setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); res = executeSampler(sampler); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, false); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, false); break; case 6: // Test sending data as UTF-8, with values similar to __VIEWSTATE parameter that .net uses, @@ -256,7 +269,9 @@ public class TestHTTPSamplersAgainstHttp res = executeSampler(sampler); assertFalse(((HTTPArgument)sampler.getArguments().getArgument(0)).isAlwaysEncoded()); assertFalse(((HTTPArgument)sampler.getArguments().getArgument(1)).isAlwaysEncoded()); - checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true); + checkPostRequestUrlEncoded(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true); break; case 7: // Test sending data as UTF-8, where user defined variables are used @@ -309,7 +324,9 @@ public class TestHTTPSamplersAgainstHttp setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); sampler.setDoMultipartPost(true); HTTPSampleResult res = executeSampler(sampler); - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue); // Test sending data as ISO-8859-1 sampler = createHttpSampler(samplerType); @@ -318,7 +335,9 @@ public class TestHTTPSamplersAgainstHttp setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); sampler.setDoMultipartPost(true); res = executeSampler(sampler); - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue); // Test sending data as UTF-8 sampler = createHttpSampler(samplerType); @@ -329,7 +348,9 @@ public class TestHTTPSamplersAgainstHttp setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); sampler.setDoMultipartPost(true); res = executeSampler(sampler); - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue); // Test sending data as UTF-8, with values that would have been urlencoded // if it was not sent as multipart @@ -341,7 +362,9 @@ public class TestHTTPSamplersAgainstHttp setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); sampler.setDoMultipartPost(true); res = executeSampler(sampler); - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue); // Test sending data as UTF-8, with values that have been urlencoded sampler = createHttpSampler(samplerType); @@ -354,7 +377,9 @@ public class TestHTTPSamplersAgainstHttp res = executeSampler(sampler); String expectedTitleValue = "mytitle/="; String expectedDescriptionValue = "mydescription /\\"; - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, expectedTitleValue, descriptionField, expectedDescriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, expectedTitleValue, + descriptionField, expectedDescriptionValue); // Test sending data as UTF-8, with values similar to __VIEWSTATE parameter that .net uses sampler = createHttpSampler(samplerType); @@ -365,7 +390,9 @@ public class TestHTTPSamplersAgainstHttp setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); sampler.setDoMultipartPost(true); res = executeSampler(sampler); - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, descriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue); // Test sending data as UTF-8, where user defined variables are used // to set the value for form data @@ -391,7 +418,9 @@ public class TestHTTPSamplersAgainstHttp res = executeSampler(sampler); expectedTitleValue = "a test\u00c5mytitle\u0153\u20a1\u0115\u00c5"; expectedDescriptionValue = "mydescription\u0153\u20a1\u0115\u00c5the_end"; - checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, expectedTitleValue, descriptionField, expectedDescriptionValue); + checkPostRequestFormMultipart(sampler, res, samplerDefaultEncoding, + contentEncoding, titleField, expectedTitleValue, + descriptionField, expectedDescriptionValue); } private void testPostRequest_FileUpload(int samplerType, String samplerDefaultEncoding) throws Exception { @@ -406,7 +435,9 @@ public class TestHTTPSamplersAgainstHttp HTTPSamplerBase sampler = createHttpSampler(samplerType); String contentEncoding = ""; setupUrl(sampler, contentEncoding); - setupFileUploadData(sampler, false, titleField, titleValue, descriptionField, descriptionValue, fileField, temporaryFile, fileMimeType); + setupFileUploadData(sampler, false, titleField, titleValue, + descriptionField, descriptionValue, fileField, temporaryFile, + fileMimeType); HTTPSampleResult res = executeSampler(sampler); checkPostRequestFileUpload(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, @@ -417,7 +448,9 @@ public class TestHTTPSamplersAgainstHttp sampler = createHttpSampler(samplerType); contentEncoding = ISO_8859_1; setupUrl(sampler, contentEncoding); - setupFileUploadData(sampler, false, titleField, titleValue, descriptionField, descriptionValue, fileField, temporaryFile, fileMimeType); + setupFileUploadData(sampler, false, titleField, titleValue, + descriptionField, descriptionValue, fileField, temporaryFile, + fileMimeType); res = executeSampler(sampler); checkPostRequestFileUpload(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, @@ -430,7 +463,9 @@ public class TestHTTPSamplersAgainstHttp titleValue = "mytitle\u0153\u20a1\u0115\u00c5"; descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5"; setupUrl(sampler, contentEncoding); - setupFileUploadData(sampler, false, titleField, titleValue, descriptionField, descriptionValue, fileField, temporaryFile, fileMimeType); + setupFileUploadData(sampler, false, titleField, titleValue, + descriptionField, descriptionValue, fileField, temporaryFile, + fileMimeType); res = executeSampler(sampler); checkPostRequestFileUpload(sampler, res, samplerDefaultEncoding, contentEncoding, titleField, titleValue, descriptionField, @@ -727,7 +762,9 @@ public class TestHTTPSamplersAgainstHttp sampler.setRunningVersion(true); executedUrl = sampler.getUrl(); sampler.setRunningVersion(false); - checkGetRequest_Parameters(sampler, res, contentEncoding, executedUrl, titleField, expectedTitleValue, descriptionField, expectedDescriptionValue, false); + checkGetRequest_Parameters(sampler, res, contentEncoding, + executedUrl, titleField, expectedTitleValue, + descriptionField, expectedDescriptionValue, false); break; case 6: break; @@ -803,7 +840,9 @@ public class TestHTTPSamplersAgainstHttp assertEquals(sampler.getUrl(), res.getURL()); String boundaryString = getBoundaryStringFromContentType(res.getRequestHeaders()); assertNotNull(boundaryString); - byte[] expectedPostBody = createExpectedFormdataOutput(boundaryString, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, true); + byte[] expectedPostBody = createExpectedFormdataOutput(boundaryString, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, true); // Check request headers checkHeaderTypeLength(res.getRequestHeaders(), "multipart/form-data" + "; boundary=" + boundaryString, expectedPostBody.length); // Check post body from the result query string @@ -889,9 +928,13 @@ public class TestHTTPSamplersAgainstHttp // Check URL assertEquals(sampler.getUrl(), res.getURL()); // Check request headers - checkHeaderTypeLength(res.getRequestHeaders(), HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, expectedPostBody.getBytes(contentEncoding).length); + checkHeaderTypeLength(res.getRequestHeaders(), + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, + expectedPostBody.getBytes(contentEncoding).length); // Check post body from the result query string - checkArraysHaveSameContent(expectedPostBody.getBytes(contentEncoding), res.getQueryString().getBytes(contentEncoding), contentEncoding, res); + checkArraysHaveSameContent(expectedPostBody.getBytes(contentEncoding), + res.getQueryString().getBytes(contentEncoding), contentEncoding, + res); // Find the data sent to the mirror server, which the mirror server is sending back to us String dataSentToMirrorServer = new String(res.getResponseData(), contentEncoding); @@ -907,10 +950,13 @@ public class TestHTTPSamplersAgainstHttp fail("No header and body section found"); } // Check response headers - checkHeaderTypeLength(headersSent, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, expectedPostBody.getBytes(contentEncoding).length); + checkHeaderTypeLength(headersSent, + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, + expectedPostBody.getBytes(contentEncoding).length); // Check post body which was sent to the mirror server, and // sent back by the mirror server - checkArraysHaveSameContent(expectedPostBody.getBytes(contentEncoding), bodySent.getBytes(contentEncoding), contentEncoding, res); + checkArraysHaveSameContent(expectedPostBody.getBytes(contentEncoding), + bodySent.getBytes(contentEncoding), contentEncoding, res); // Check method, path and query sent checkMethodPathQuery(headersSent, sampler.getMethod(), sampler.getPath(), (String) null, res); } @@ -1101,7 +1147,10 @@ public class TestHTTPSamplersAgainstHttp private String getSentRequestHeaderValue(String requestHeaders, String headerName) { Perl5Matcher localMatcher = JMeterUtils.getMatcher(); String expression = ".*" + headerName + ": (\\d*).*"; - Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK); + Pattern pattern = JMeterUtils.getPattern(expression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.SINGLELINE_MASK); if(localMatcher.matches(requestHeaders, pattern)) { // The value is in the first group, group 0 is the whole match return localMatcher.getMatch().group(1); @@ -1111,7 +1160,10 @@ public class TestHTTPSamplersAgainstHttp private boolean checkRegularExpression(String stringToCheck, String regularExpression) { Perl5Matcher localMatcher = JMeterUtils.getMatcher(); - Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK); + Pattern pattern = JMeterUtils.getPattern(regularExpression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.SINGLELINE_MASK); return localMatcher.contains(stringToCheck, pattern); } @@ -1119,7 +1171,10 @@ public class TestHTTPSamplersAgainstHttp Perl5Matcher localMatcher = JMeterUtils.getMatcher(); // The headers and body are divided by a blank line String regularExpression = "^.$"; - Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); + Pattern pattern = JMeterUtils.getPattern(regularExpression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.MULTILINE_MASK); PatternMatcherInput input = new PatternMatcherInput(stringToCheck); while(localMatcher.contains(input, pattern)) { @@ -1133,7 +1188,10 @@ public class TestHTTPSamplersAgainstHttp private String getBoundaryStringFromContentType(String requestHeaders) { Perl5Matcher localMatcher = JMeterUtils.getMatcher(); String regularExpression = "^" + HTTPConstants.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$"; - Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); + Pattern pattern = JMeterUtils.getPattern(regularExpression, + Perl5Compiler.READ_ONLY_MASK + | Perl5Compiler.CASE_INSENSITIVE_MASK + | Perl5Compiler.MULTILINE_MASK); if(localMatcher.contains(requestHeaders, pattern)) { MatchResult match = localMatcher.getMatch(); String matchString = match.group(1); @@ -1167,7 +1225,8 @@ public class TestHTTPSamplersAgainstHttp * * @param httpSampler */ - private void setupFormData(HTTPSamplerBase httpSampler, boolean isEncoded, String titleField, String titleValue, String descriptionField, String descriptionValue) { + private void setupFormData(HTTPSamplerBase httpSampler, boolean isEncoded, String titleField, + String titleValue, String descriptionField, String descriptionValue) { if(isEncoded) { httpSampler.addEncodedArgument(titleField, titleValue); httpSampler.addEncodedArgument(descriptionField, descriptionValue); @@ -1208,7 +1267,8 @@ public class TestHTTPSamplersAgainstHttp * @param actual * @throws UnsupportedEncodingException */ - private void checkArraysHaveSameContent(byte[] expected, byte[] actual, String encoding, HTTPSampleResult res) throws UnsupportedEncodingException { + private void checkArraysHaveSameContent(byte[] expected, byte[] actual, String encoding, + HTTPSampleResult res) throws UnsupportedEncodingException { if(expected != null && actual != null) { if(expected.length != actual.length) { System.out.println("\n>>>>>>>>>>>>>>>>>>>> expected:"); @@ -1401,8 +1461,11 @@ public class TestHTTPSamplersAgainstHttp String fileMimeType, byte[] fileContent) throws IOException { // Create the multiparts - byte[] formdataMultipart = createExpectedFormdataOutput(boundaryString, contentEncoding, titleField, titleValue, descriptionField, descriptionValue, true, false); - byte[] fileMultipart = createExpectedFilepartOutput(boundaryString, fileField, fileValue, fileMimeType, fileContent, false, true); + byte[] formdataMultipart = createExpectedFormdataOutput(boundaryString, + contentEncoding, titleField, titleValue, descriptionField, + descriptionValue, true, false); + byte[] fileMultipart = createExpectedFilepartOutput(boundaryString, + fileField, fileValue, fileMimeType, fileContent, false, true); // Join the two multiparts ByteArrayOutputStream output = new ByteArrayOutputStream();