Am 5. Januar 2016 23:49:48 MEZ, schrieb sebb <[email protected]>: >On 20 December 2015 at 16:09, <[email protected]> wrote: >> Author: pmouawad >> Date: Sun Dec 20 16:09:49 2015 >> New Revision: 1721041 >> >> URL: http://svn.apache.org/viewvc?rev=1721041&view=rev >> Log: >> Bug 58756 - CookieManager : Cookie Policy select box content must >depend on Cookie implementation >> Bugzilla Id: 58756 >> >> Modified: >> >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java >> >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java >> >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java >> jmeter/trunk/xdocs/changes.xml >> >> Modified: >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java >> URL: >http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java?rev=1721041&r1=1721040&r2=1721041&view=diff >> >============================================================================== >> --- >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java >(original) >> +++ >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java >Sun Dec 20 16:09:49 2015 >> @@ -36,6 +36,15 @@ import org.apache.log.Logger; >> public class HC3CookieHandler implements CookieHandler { >> private static final Logger log = >LoggingManager.getLoggerForClass(); >> >> + public static final String[] AVAILABLE_POLICIES = new String[] { > >-1 > >Array entries are mutable and should never be exposed
I always wondered, why there so few enums used in our code. Felix > >> + "default", >> + "compatibility", >> + "rfc2109", >> + "rfc2965", >> + "ignorecookies", >> + "netscape" >> + }; >> + >> private final transient CookieSpec cookieSpec; >> >> /** >> >> Modified: >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java >> URL: >http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java?rev=1721041&r1=1721040&r2=1721041&view=diff >> >============================================================================== >> --- >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java >(original) >> +++ >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java >Sun Dec 20 16:09:49 2015 >> @@ -54,6 +54,18 @@ import org.apache.log.Logger; >> public class HC4CookieHandler implements CookieHandler { >> private static final Logger log = >LoggingManager.getLoggerForClass(); >> >> + public static final String[] AVAILABLE_POLICIES = new String[]{ > >-1 > >Array entries are mutable and should never be exposed > >> + CookieSpecs.DEFAULT, >> + CookieSpecs.STANDARD, >> + CookieSpecs.STANDARD_STRICT, >> + CookieSpecs.IGNORE_COOKIES, >> + CookieSpecs.BEST_MATCH, >> + CookieSpecs.BROWSER_COMPATIBILITY, >> + "rfc2109", >> + "rfc2965", >> + CookieSpecs.NETSCAPE >> + }; >> + >> private final transient CookieSpec cookieSpec; >> >> private static PublicSuffixMatcher publicSuffixMatcher = >PublicSuffixMatcherLoader.getDefault(); >> >> Modified: >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java >> URL: >http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java?rev=1721041&r1=1721040&r2=1721041&view=diff >> >============================================================================== >> --- >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java >(original) >> +++ >jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java >Sun Dec 20 16:09:49 2015 >> @@ -49,6 +49,7 @@ import org.apache.jmeter.protocol.http.c >> import org.apache.jmeter.protocol.http.control.CookieHandler; >> import org.apache.jmeter.protocol.http.control.CookieManager; >> import org.apache.jmeter.protocol.http.control.HC3CookieHandler; >> +import org.apache.jmeter.protocol.http.control.HC4CookieHandler; >> import org.apache.jmeter.testelement.TestElement; >> import org.apache.jmeter.testelement.property.JMeterProperty; >> import org.apache.jmeter.util.JMeterUtils; >> @@ -117,20 +118,6 @@ public class CookiePanel extends Abstrac >> >> private JButton saveButton; >> >> - /** >> - * List of cookie policies. >> - * >> - * These are used both for the display, and for setting the >policy >> - */ >> - private final String[] policies = new String[] { >> - "default", >> - "compatibility", >> - "rfc2109", >> - "rfc2965", >> - "ignorecookies", >> - "netscape" >> - }; >> - >> private JLabeledChoice policy; >> >> /** >> @@ -234,7 +221,23 @@ public class CookiePanel extends Abstrac >> } catch (IOException ex) { >> JMeterUtils.reportErrorToUser(ex.getMessage(), >"Error saving cookies"); >> } >> + } else if (action.equals(HANDLER_COMMAND)) { >> + >policy.setValues(getPolicies(handlerMap.get(selectHandlerPanel.getSelectedItem()))); >> + } >> + } >> + >> + /** >> + * @param className CookieHandler class name >> + * @return cookie policies >> + */ >> + private static String[] getPolicies(String className) { >> + // TODO it would be better if CookieHandler had a method >getSupportedPolicies() and empty constructor >> + if(HC3CookieHandler.class.getName().equals(className)) { >> + return HC3CookieHandler.AVAILABLE_POLICIES; >> + } else >if(HC4CookieHandler.class.getName().equals(className)) { >> + return HC4CookieHandler.AVAILABLE_POLICIES; >> } >> + return HC4CookieHandler.AVAILABLE_POLICIES; >> } >> >> private void addCookieToTable(Cookie cookie) { >> @@ -326,7 +329,7 @@ public class CookiePanel extends Abstrac >> new >JCheckBox(JMeterUtils.getResString("clear_cookies_per_iter"), false); >//$NON-NLS-1$ >> policy = new JLabeledChoice( >> JMeterUtils.getResString("cookie_manager_policy"), >//$NON-NLS-1$ >> - policies); >> + getPolicies(CookieManager.DEFAULT_IMPLEMENTATION)); >> policy.setText(CookieManager.DEFAULT_POLICY); >> setLayout(new BorderLayout()); >> setBorder(makeBorder()); >> @@ -341,9 +344,9 @@ public class CookiePanel extends Abstrac >> optionsPane.add(clearEachIteration); >> JPanel policyTypePane = new JPanel(); >> policyTypePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, >0)); >> - policyTypePane.add(policy); >> policyTypePane.add(GuiUtils.createLabelCombo( >> >JMeterUtils.getResString("cookie_implementation_choose"), >createComboHandler())); // $NON-NLS-1$ >> + policyTypePane.add(policy); >> optionsPane.add(policyTypePane); >> northPanel.add(optionsPane); >> add(northPanel, BorderLayout.NORTH); >> @@ -414,7 +417,7 @@ public class CookiePanel extends Abstrac >> String tmpName = null; >> for (String clazz : classesToAdd) { >> String shortClazz = >clazz.substring(clazz.lastIndexOf('.') + 1); >> - if (HC3CookieHandler.class.getName().equals(clazz)) { >> + if (CookieManager.DEFAULT_IMPLEMENTATION.equals(clazz)) >{ >> tmpName = shortClazz; >> } >> selectHandlerPanel.addItem(shortClazz); >> >> Modified: jmeter/trunk/xdocs/changes.xml >> URL: >http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1721041&r1=1721040&r2=1721041&view=diff >> >============================================================================== >> --- jmeter/trunk/xdocs/changes.xml (original) >> +++ jmeter/trunk/xdocs/changes.xml Sun Dec 20 16:09:49 2015 >> @@ -123,6 +123,7 @@ Summary >> <li><bug>58303</bug>Change usage of bouncycastle api in >SMIMEAssertion to get rid of deprecation warnings.</li> >> <li><bug>58515</bug>New JSON related components : JSON-PATH >Extractor and JSON-PATH Renderer in View Results Tree. Donated by Ubik >Load Pack (support at ubikloadpack.com).</li> >> <li><bug>58698</bug>Correct parsing of auth-files in HTTP >Authorization Manager.</li> >> + <li><bug>58756</bug>CookieManager : Cookie Policy select box >content must depend on Cookie implementation.</li> >> </ul> >> >> <h3>Functions</h3> >> >>
