Author: sebb Date: Sat May 5 16:40:43 2007 New Revision: 535574 URL: http://svn.apache.org/viewvc?view=rev&rev=535574 Log: Add NLS markers; extract string constants and general tidy up
Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgument.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapConfigGui.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapClient.java jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapExtClient.java Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgument.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgument.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgument.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgument.java Sat May 5 16:40:43 2007 @@ -1,4 +1,3 @@ -//$Header$ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -44,16 +43,16 @@ // TODO should these be public? /** Name used to store the argument's name. */ - public static final String ARG_NAME = "Argument.name"; + public static final String ARG_NAME = "Argument.name"; //$NON-NLS$ /** Name used to store the argument's value. */ - public static final String VALUE = "Argument.value"; + public static final String VALUE = "Argument.value"; //$NON-NLS$ /** Name used to store the argument's value. */ - public static final String OPCODE = "Argument.opcode"; + public static final String OPCODE = "Argument.opcode"; //$NON-NLS$ /** Name used to store the argument's metadata. */ - public static final String METADATA = "Argument.metadata"; + public static final String METADATA = "Argument.metadata"; //$NON-NLS$ /** * Create a new Argument without a name, value, or metadata. Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArguments.java Sat May 5 16:40:43 2007 @@ -1,4 +1,3 @@ -//$Header$ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -46,7 +45,7 @@ public class LDAPArguments extends ConfigTestElement implements Serializable { /** The name of the property used to store the arguments. */ - public static final String ARGUMENTS = "Arguments.arguments"; + public static final String ARGUMENTS = "Arguments.arguments"; //$NON-NLS$ /** * Create a new Arguments object with no arguments. @@ -157,13 +156,16 @@ PropertyIterator iter = getArguments().iterator(); while (iter.hasNext()) { LDAPArgument arg = (LDAPArgument) iter.next().getObjectValue(); - if (arg.getMetaData() == null) { - str.append(arg.getName() + "=" + arg.getValue()); + final String metaData = arg.getMetaData(); + str.append(arg.getName()); + if (metaData == null) { + str.append("="); //$NON-NLS$ } else { - str.append(arg.getName() + arg.getMetaData() + arg.getValue()); + str.append(metaData); } + str.append(arg.getValue()); if (iter.hasNext()) { - str.append("&"); + str.append("&"); //$NON-NLS$ } } return str.toString(); Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java Sat May 5 16:40:43 2007 @@ -75,19 +75,22 @@ private JButton delete; /** Command for adding a row to the table. */ - private static final String ADD = "add"; + private static final String ADD = "add"; //$NON-NLS-1$ /** Command for removing a row from the table. */ - private static final String DELETE = "delete"; + private static final String DELETE = "delete"; //$NON-NLS-1$ - private static final String[] COLUMN_NAMES = { JMeterUtils.getResString("attribute"), - JMeterUtils.getResString("value"), JMeterUtils.getResString("opcode"), JMeterUtils.getResString("metadata") }; + private static final String[] COLUMN_NAMES = { + JMeterUtils.getResString("attribute"), //$NON-NLS-1$ + JMeterUtils.getResString("value"), //$NON-NLS-1$ + JMeterUtils.getResString("opcode"), //$NON-NLS-1$ + JMeterUtils.getResString("metadata") }; //$NON-NLS-1$ /** * Create a new LDAPArgumentsPanel, using the default title. */ public LDAPArgumentsPanel() { - this(JMeterUtils.getResString("paramtable")); + this(JMeterUtils.getResString("paramtable")); //$NON-NLS-1$ } /** @@ -379,11 +382,11 @@ * @return a GUI panel containing the buttons */ private JPanel makeButtonPanel() { - add = new JButton(JMeterUtils.getResString("add")); + add = new JButton(JMeterUtils.getResString("add")); //$NON-NLS-1$ add.setActionCommand(ADD); add.setEnabled(true); - delete = new JButton(JMeterUtils.getResString("delete")); + delete = new JButton(JMeterUtils.getResString("delete")); //$NON-NLS-1$ delete.setActionCommand(DELETE); checkDeleteStatus(); Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapConfigGui.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapConfigGui.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapConfigGui.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapConfigGui.java Sat May 5 16:40:43 2007 @@ -48,7 +48,6 @@ * * Created Apr 29 2003 11:45 AM * - * @version $Revision$ Last updated: $Date$ */ public class LdapConfigGui extends AbstractConfigGui implements ItemListener { @@ -68,23 +67,23 @@ private JTextField port = new JTextField(20); - private JCheckBox user_Defined = new JCheckBox(JMeterUtils.getResString("user_defined_test")); + private JCheckBox user_Defined = new JCheckBox(JMeterUtils.getResString("user_defined_test")); // $NON-NLS-1$ - private JRadioButton addTest = new JRadioButton(JMeterUtils.getResString("add_test")); + private JRadioButton addTest = new JRadioButton(JMeterUtils.getResString("add_test")); // $NON-NLS-1$ - private JRadioButton modifyTest = new JRadioButton(JMeterUtils.getResString("modify_test")); + private JRadioButton modifyTest = new JRadioButton(JMeterUtils.getResString("modify_test")); // $NON-NLS-1$ - private JRadioButton deleteTest = new JRadioButton(JMeterUtils.getResString("delete_test")); + private JRadioButton deleteTest = new JRadioButton(JMeterUtils.getResString("delete_test")); // $NON-NLS-1$ - private JRadioButton searchTest = new JRadioButton(JMeterUtils.getResString("search_test")); + private JRadioButton searchTest = new JRadioButton(JMeterUtils.getResString("search_test")); // $NON-NLS-1$ private ButtonGroup bGroup = new ButtonGroup(); private boolean displayName = true; - ArgumentsPanel tableAddPanel = new ArgumentsPanel(JMeterUtils.getResString("add_test")); + ArgumentsPanel tableAddPanel = new ArgumentsPanel(JMeterUtils.getResString("add_test")); // $NON-NLS-1$ - ArgumentsPanel tableModifyPanel = new ArgumentsPanel(JMeterUtils.getResString("modify_test")); + ArgumentsPanel tableModifyPanel = new ArgumentsPanel(JMeterUtils.getResString("modify_test")); // $NON-NLS-1$ private JPanel cards; @@ -96,7 +95,7 @@ } public String getLabelResource() { - return "ldap_sample_title"; + return "ldap_sample_title"; // $NON-NLS-1$ } /** @@ -114,21 +113,22 @@ port.setText(element.getPropertyAsString(LDAPSampler.PORT)); rootdn.setText(element.getPropertyAsString(LDAPSampler.ROOTDN)); CardLayout cl = (CardLayout) (cards.getLayout()); - if (element.getPropertyAsString(LDAPSampler.TEST).equals("add")) { + final String testType = element.getPropertyAsString(LDAPSampler.TEST); + if (testType.equals(LDAPSampler.ADD)) { addTest.setSelected(true); add.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN)); tableAddPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue()); cl.show(cards, "Add"); - } else if (element.getPropertyAsString(LDAPSampler.TEST).equals("modify")) { + } else if (testType.equals(LDAPSampler.MODIFY)) { modifyTest.setSelected(true); modify.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN)); tableModifyPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue()); cl.show(cards, "Modify"); - } else if (element.getPropertyAsString(LDAPSampler.TEST).equals("delete")) { + } else if (testType.equals(LDAPSampler.DELETE)) { deleteTest.setSelected(true); delete.setText(element.getPropertyAsString(LDAPSampler.DELETE)); cl.show(cards, "Delete"); - } else if (element.getPropertyAsString(LDAPSampler.TEST).equals("search")) { + } else if (testType.equals(LDAPSampler.SEARCHBASE)) { searchTest.setSelected(true); searchbase.setText(element.getPropertyAsString(LDAPSampler.SEARCHBASE)); searchfilter.setText(element.getPropertyAsString(LDAPSampler.SEARCHFILTER)); @@ -139,7 +139,7 @@ user_Defined.setSelected(true); } else { user_Defined.setSelected(false); - cl.show(cards, ""); + cl.show(cards, ""); // $NON-NLS-1$ } } @@ -218,51 +218,51 @@ if (addTest.isSelected()) { cl.show(cards, "Add"); tableModifyPanel.clear(); - modify.setText(""); - searchbase.setText(""); - searchfilter.setText(""); + modify.setText(""); // $NON-NLS-1$ + searchbase.setText(""); // $NON-NLS-1$ + searchfilter.setText(""); // $NON-NLS-1$ delete.setText(""); } else if (deleteTest.isSelected()) { cl.show(cards, "Delete"); tableModifyPanel.clear(); - modify.setText(""); + modify.setText(""); // $NON-NLS-1$ tableAddPanel.clear(); - add.setText(""); - searchbase.setText(""); - searchfilter.setText(""); + add.setText(""); // $NON-NLS-1$ + searchbase.setText(""); // $NON-NLS-1$ + searchfilter.setText(""); // $NON-NLS-1$ } else if (searchTest.isSelected()) { cl.show(cards, "Search"); - delete.setText(""); + delete.setText(""); // $NON-NLS-1$ tableModifyPanel.clear(); - modify.setText(""); + modify.setText(""); // $NON-NLS-1$ tableAddPanel.clear(); - add.setText(""); + add.setText(""); // $NON-NLS-1$ } else if (modifyTest.isSelected()) { cl.show(cards, "Modify"); tableAddPanel.clear(); - add.setText(""); - searchbase.setText(""); - searchfilter.setText(""); + add.setText(""); // $NON-NLS-1$ + searchbase.setText(""); // $NON-NLS-1$ + searchfilter.setText(""); // $NON-NLS-1$ delete.setText(""); } else { - cl.show(cards, ""); + cl.show(cards, ""); // $NON-NLS-1$ tableAddPanel.clear(); - add.setText(""); + add.setText(""); // $NON-NLS-1$ tableModifyPanel.clear(); - modify.setText(""); - searchbase.setText(""); - searchfilter.setText(""); - delete.setText(""); + modify.setText(""); // $NON-NLS-1$ + searchbase.setText(""); // $NON-NLS-1$ + searchfilter.setText(""); // $NON-NLS-1$ + delete.setText(""); // $NON-NLS-1$ } } else { - cl.show(cards, ""); + cl.show(cards, ""); // $NON-NLS-1$ tableAddPanel.clear(); - add.setText(""); + add.setText(""); // $NON-NLS-1$ tableModifyPanel.clear(); - modify.setText(""); - searchbase.setText(""); - searchfilter.setText(""); - delete.setText(""); + modify.setText(""); // $NON-NLS-1$ + searchbase.setText(""); // $NON-NLS-1$ + searchfilter.setText(""); // $NON-NLS-1$ + delete.setText(""); // $NON-NLS-1$ } } @@ -276,7 +276,7 @@ */ private JPanel createServernamePanel() { JPanel serverPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("servername")); + JLabel label = new JLabel(JMeterUtils.getResString("servername")); // $NON-NLS-1$ label.setLabelFor(servername); serverPanel.add(label, BorderLayout.WEST); serverPanel.add(servername, BorderLayout.CENTER); @@ -288,7 +288,7 @@ */ private JPanel createPortPanel() { JPanel portPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("port")); + JLabel label = new JLabel(JMeterUtils.getResString("port")); // $NON-NLS-1$ label.setLabelFor(port); portPanel.add(label, BorderLayout.WEST); portPanel.add(port, BorderLayout.CENTER); @@ -300,7 +300,7 @@ */ private JPanel createRootdnPanel() { JPanel rootdnPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("dn")); + JLabel label = new JLabel(JMeterUtils.getResString("dn")); // $NON-NLS-1$ label.setLabelFor(rootdn); rootdnPanel.add(label, BorderLayout.WEST); rootdnPanel.add(rootdn, BorderLayout.CENTER); @@ -313,12 +313,12 @@ private JPanel createSearchPanel() { VerticalPanel searchPanel = new VerticalPanel(); JPanel searchBPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("search_base")); + JLabel label = new JLabel(JMeterUtils.getResString("search_base")); // $NON-NLS-1$ label.setLabelFor(searchbase); searchBPanel.add(label, BorderLayout.WEST); searchBPanel.add(searchbase, BorderLayout.CENTER); JPanel searchFPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label2 = new JLabel(JMeterUtils.getResString("search_filter")); + JLabel label2 = new JLabel(JMeterUtils.getResString("search_filter")); // $NON-NLS-1$ label2.setLabelFor(searchfilter); searchFPanel.add(label2, BorderLayout.WEST); searchFPanel.add(searchfilter, BorderLayout.CENTER); @@ -333,7 +333,7 @@ private JPanel createDeletePanel() { VerticalPanel panel = new VerticalPanel(); JPanel deletePanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("delete")); + JLabel label = new JLabel(JMeterUtils.getResString("delete")); // $NON-NLS-1$ label.setLabelFor(delete); deletePanel.add(label, BorderLayout.WEST); deletePanel.add(delete, BorderLayout.CENTER); @@ -347,7 +347,7 @@ private JPanel createAddPanel() { JPanel addPanel = new JPanel(new BorderLayout(5, 0)); JPanel addInnerPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("entry_dn")); + JLabel label = new JLabel(JMeterUtils.getResString("entry_dn")); // $NON-NLS-1$ label.setLabelFor(add); addInnerPanel.add(label, BorderLayout.WEST); addInnerPanel.add(add, BorderLayout.CENTER); @@ -362,7 +362,7 @@ private JPanel createModifyPanel() { JPanel modifyPanel = new JPanel(new BorderLayout(5, 0)); JPanel modifyInnerPanel = new JPanel(new BorderLayout(5, 0)); - JLabel label = new JLabel(JMeterUtils.getResString("entry_dn")); + JLabel label = new JLabel(JMeterUtils.getResString("entry_dn")); // $NON-NLS-1$ label.setLabelFor(modify); modifyInnerPanel.add(label, BorderLayout.WEST); modifyInnerPanel.add(modify, BorderLayout.CENTER); @@ -391,9 +391,9 @@ */ private JPanel createTestPanel() { JPanel testPanel = new JPanel(new BorderLayout()); - testPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("test_configuration"))); + testPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("test_configuration"))); // $NON-NLS-1$ - testPanel.add(new JLabel(JMeterUtils.getResString("test"))); + testPanel.add(new JLabel(JMeterUtils.getResString("test"))); // $NON-NLS-1$ JPanel rowPanel = new JPanel(); rowPanel.add(addTest); Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapExtConfigGui.java Sat May 5 16:40:43 2007 @@ -88,7 +88,17 @@ JMeterUtils.getResString("ldap_search_onelevel"),// $NON-NLS-1$ JMeterUtils.getResString("ldap_search_subtree"),// $NON-NLS-1$ }; - + + // Names for the cards + private static final String CARDS_DEFAULT = ""; // $NON-NLS-1$ + private static final String CARDS_ADD = "Add"; // $NON-NLS-1$ + private static final String CARDS_DELETE = "Delete"; // $NON-NLS-1$ + private static final String CARDS_BIND = "Bind"; // $NON-NLS-1$ + private static final String CARDS_RENAME = "Rename"; // $NON-NLS-1$ + private static final String CARDS_COMPARE = "Compare"; // $NON-NLS-1$ + private static final String CARDS_SEARCH = "Search"; // $NON-NLS-1$ + private static final String CARDS_MODIFY = "Modify"; // $NON-NLS-1$ + private JLabeledChoice scope = new JLabeledChoice(JMeterUtils.getResString("scope"), // $NON-NLS-1$ SCOPE_STRINGS); @@ -121,13 +131,13 @@ private JCheckBox secure = new JCheckBox(JMeterUtils.getResString("ldap_secure")); // $NON-NLS-1$ - private JRadioButton addTest = new JRadioButton(JMeterUtils.getResString("addTest")); // $NON-NLS-1$ + private JRadioButton addTest = new JRadioButton(JMeterUtils.getResString("addtest")); // $NON-NLS-1$ - private JRadioButton modifyTest = new JRadioButton(JMeterUtils.getResString("modTest")); // $NON-NLS-1$ + private JRadioButton modifyTest = new JRadioButton(JMeterUtils.getResString("modtest")); // $NON-NLS-1$ - private JRadioButton deleteTest = new JRadioButton(JMeterUtils.getResString("delTest")); // $NON-NLS-1$ + private JRadioButton deleteTest = new JRadioButton(JMeterUtils.getResString("deltest")); // $NON-NLS-1$ - private JRadioButton searchTest = new JRadioButton(JMeterUtils.getResString("searchTest")); // $NON-NLS-1$ + private JRadioButton searchTest = new JRadioButton(JMeterUtils.getResString("searchtest")); // $NON-NLS-1$ private JRadioButton bind = new JRadioButton(JMeterUtils.getResString("bind")); // $NON-NLS-1$ @@ -143,9 +153,9 @@ private boolean displayName = true; - ArgumentsPanel tableAddPanel = new ArgumentsPanel(JMeterUtils.getResString("addTest")); // $NON-NLS-1$ + ArgumentsPanel tableAddPanel = new ArgumentsPanel(JMeterUtils.getResString("addtest")); // $NON-NLS-1$ - LDAPArgumentsPanel tableModifyPanel = new LDAPArgumentsPanel(JMeterUtils.getResString("modTest")); // $NON-NLS-1$ + LDAPArgumentsPanel tableModifyPanel = new LDAPArgumentsPanel(JMeterUtils.getResString("modtest")); // $NON-NLS-1$ private JPanel cards; @@ -201,41 +211,42 @@ modddn.setText(element.getPropertyAsString(LDAPExtSampler.MODDDN)); newdn.setText(element.getPropertyAsString(LDAPExtSampler.NEWDN)); CardLayout cl = (CardLayout) (cards.getLayout()); - if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("unbind")) { // $NON-NLS-1$ + final String testType = element.getPropertyAsString(LDAPExtSampler.TEST); + if (testType.equals(LDAPExtSampler.UNBIND)) { unbind.setSelected(true); - cl.show(cards, "unbind"); - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("bind")) { // $NON-NLS-1$ + cl.show(cards, CARDS_DEFAULT); + } else if (testType.equals(LDAPExtSampler.BIND)) { bind.setSelected(true); - cl.show(cards, "bind"); - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("sbind")) { // $NON-NLS-1$ + cl.show(cards, CARDS_BIND); + } else if (testType.equals(LDAPExtSampler.SBIND)) { sbind.setSelected(true); - cl.show(cards, "sbind"); - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("compare")) { // $NON-NLS-1$ + cl.show(cards, CARDS_DEFAULT); + } else if (testType.equals(LDAPExtSampler.COMPARE)) { compare.setSelected(true); - cl.show(cards, "compare"); - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("add")) { // $NON-NLS-1$ + cl.show(cards, CARDS_COMPARE); + } else if (testType.equals(LDAPExtSampler.ADD)) { addTest.setSelected(true); add.setText(element.getPropertyAsString(LDAPExtSampler.BASE_ENTRY_DN)); tableAddPanel.configure((TestElement) element.getProperty(LDAPExtSampler.ARGUMENTS).getObjectValue()); - cl.show(cards, "Add"); // $NON-NLS-1$ - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("modify")) { // $NON-NLS-1$ + cl.show(cards, CARDS_ADD); + } else if (testType.equals(LDAPExtSampler.MODIFY)) { modifyTest.setSelected(true); modify.setText(element.getPropertyAsString(LDAPExtSampler.BASE_ENTRY_DN)); tableModifyPanel .configure((TestElement) element.getProperty(LDAPExtSampler.LDAPARGUMENTS).getObjectValue()); - cl.show(cards, "Modify"); // $NON-NLS-1$ - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("delete")) { // $NON-NLS-1$ + cl.show(cards, CARDS_MODIFY); + } else if (testType.equals(LDAPExtSampler.DELETE)) { deleteTest.setSelected(true); delete.setText(element.getPropertyAsString(LDAPExtSampler.DELETE)); - cl.show(cards, "Delete"); // $NON-NLS-1$ - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("rename")) { // $NON-NLS-1$ + cl.show(cards, CARDS_DELETE); + } else if (testType.equals(LDAPExtSampler.RENAME)) { rename.setSelected(true); - cl.show(cards, "rename"); // $NON-NLS-1$ - } else if (element.getPropertyAsString(LDAPExtSampler.TEST).equals("search")) { // $NON-NLS-1$ + cl.show(cards, CARDS_RENAME); + } else if (testType.equals(LDAPExtSampler.SEARCH)) { searchTest.setSelected(true); searchbase.setText(element.getPropertyAsString(LDAPExtSampler.SEARCHBASE)); searchfilter.setText(element.getPropertyAsString(LDAPExtSampler.SEARCHFILTER)); - cl.show(cards, "Search"); // $NON-NLS-1$ + cl.show(cards, CARDS_SEARCH); } } @@ -360,23 +371,23 @@ public void itemStateChanged(ItemEvent ie) { CardLayout cl = (CardLayout) (cards.getLayout()); if (addTest.isSelected()) { - cl.show(cards, "Add"); // $NON-NLS-1$ + cl.show(cards, CARDS_ADD); } else if (deleteTest.isSelected()) { - cl.show(cards, "Delete"); // $NON-NLS-1$ + cl.show(cards, CARDS_DELETE); } else if (bind.isSelected()) { - cl.show(cards, "Bind"); // $NON-NLS-1$ + cl.show(cards, CARDS_BIND); } else if (sbind.isSelected()) { - cl.show(cards, "Bind"); // $NON-NLS-1$ + cl.show(cards, CARDS_BIND); } else if (rename.isSelected()) { - cl.show(cards, "Rename"); // $NON-NLS-1$ + cl.show(cards, CARDS_RENAME); } else if (compare.isSelected()) { - cl.show(cards, "Compare"); // $NON-NLS-1$ + cl.show(cards, CARDS_COMPARE); } else if (searchTest.isSelected()) { - cl.show(cards, "Search"); // $NON-NLS-1$ + cl.show(cards, CARDS_SEARCH); } else if (modifyTest.isSelected()) { - cl.show(cards, "Modify"); // $NON-NLS-1$ + cl.show(cards, CARDS_MODIFY); } else { // e.g unbind - cl.show(cards, ""); // $NON-NLS-1$ + cl.show(cards, CARDS_DEFAULT); } } @@ -614,14 +625,14 @@ **************************************************************************/ private JPanel testPanel() { cards = new JPanel(new CardLayout()); - cards.add(new JPanel(), ""); // $NON-NLS-1$ - cards.add(createAddPanel(), "Add"); // $NON-NLS-1$ - cards.add(createModifyPanel(), "Modify"); // $NON-NLS-1$ - cards.add(createModdnPanel(), "Rename"); // $NON-NLS-1$ - cards.add(createDeletePanel(), "Delete"); // $NON-NLS-1$ - cards.add(createSearchPanel(), "Search"); // $NON-NLS-1$ - cards.add(createBindPanel(), "Bind"); // $NON-NLS-1$ - cards.add(createComparePanel(), "Compare"); // $NON-NLS-1$ + cards.add(new JPanel(), CARDS_DEFAULT); + cards.add(createAddPanel(), CARDS_ADD); + cards.add(createModifyPanel(), CARDS_MODIFY); + cards.add(createModdnPanel(), CARDS_RENAME); + cards.add(createDeletePanel(), CARDS_DELETE); + cards.add(createSearchPanel(), CARDS_SEARCH); + cards.add(createBindPanel(), CARDS_BIND); + cards.add(createComparePanel(), CARDS_COMPARE); return cards; } Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java Sat May 5 16:40:43 2007 @@ -87,7 +87,7 @@ } public String getLabelResource() { - return "ldap_testing_title"; + return "ldap_testing_title"; // $NON-NLS-1$ } private void init() { @@ -97,7 +97,7 @@ VerticalPanel mainPanel = new VerticalPanel(); loginPanel = new LoginConfigGui(false); ldapDefaultPanel = new LdapConfigGui(false); - loginPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("login_config"))); + loginPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("login_config"))); // $NON-NLS-1$ add(makeTitlePanel(), BorderLayout.NORTH); mainPanel.add(loginPanel); mainPanel.add(ldapDefaultPanel); Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java Sat May 5 16:40:43 2007 @@ -593,7 +593,9 @@ * @return a formatted string label describing this sampler */ public String getLabel() { - return ("ldap://" + this.getServername() + ":" + getPort() + "/" + this.getRootdn()); + return ("ldap://" + this.getServername() //$NON-NLS-1$ + + ":" + getPort() //$NON-NLS-1$ + + "/" + this.getRootdn()); //$NON-NLS-1$ } /*************************************************************************** Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java Sat May 5 16:40:43 2007 @@ -44,34 +44,33 @@ * * @author T.Elanjchezhiyan([EMAIL PROTECTED]) - Sip Technologies and * Exports Ltd. Created Apr 29 2003 11:00 AM - * @version $Revision$ Last updated: $Date$ */ public class LDAPSampler extends AbstractSampler { transient private static Logger log = LoggingManager.getLoggerForClass(); - public final static String SERVERNAME = "servername"; + public final static String SERVERNAME = "servername"; //$NON-NLS-1$ - public final static String PORT = "port"; + public final static String PORT = "port"; //$NON-NLS-1$ - public final static String ROOTDN = "rootdn"; + public final static String ROOTDN = "rootdn"; //$NON-NLS-1$ - public final static String TEST = "test"; + public final static String TEST = "test"; //$NON-NLS-1$ - public final static String ADD = "add"; + public final static String ADD = "add"; //$NON-NLS-1$ - public final static String MODIFY = "modify"; + public final static String MODIFY = "modify"; //$NON-NLS-1$ - public final static String DELETE = "delete"; + public final static String DELETE = "delete"; //$NON-NLS-1$ - public final static String SEARCHBASE = "search"; + public final static String SEARCHBASE = "search"; //$NON-NLS-1$ - public final static String SEARCHFILTER = "searchfilter"; + public final static String SEARCHFILTER = "searchfilter"; //$NON-NLS-1$ - public final static String USER_DEFINED = "user_defined"; + public final static String USER_DEFINED = "user_defined"; //$NON-NLS-1$ - public final static String ARGUMENTS = "arguments"; + public final static String ARGUMENTS = "arguments"; //$NON-NLS-1$ - public final static String BASE_ENTRY_DN = "base_entry_dn"; + public final static String BASE_ENTRY_DN = "base_entry_dn"; //$NON-NLS-1$ // For In build test case using this counter // create the new entry in the server @@ -243,11 +242,11 @@ * @return the BasicAttributes */ private BasicAttributes getUserAttributes() { - BasicAttribute basicattribute = new BasicAttribute("objectclass"); - basicattribute.add("top"); - basicattribute.add("person"); - basicattribute.add("organizationalPerson"); - basicattribute.add("inetOrgPerson"); + BasicAttribute basicattribute = new BasicAttribute("objectclass"); //$NON-NLS-1$ + basicattribute.add("top"); //$NON-NLS-1$ + basicattribute.add("person"); //$NON-NLS-1$ + basicattribute.add("organizationalPerson"); //$NON-NLS-1$ + basicattribute.add("inetOrgPerson"); //$NON-NLS-1$ BasicAttributes attrs = new BasicAttributes(true); attrs.put(basicattribute); BasicAttribute attr; @@ -291,9 +290,9 @@ private ModificationItem[] getModificationItem() { ModificationItem[] mods = new ModificationItem[2]; // replace (update) attribute - Attribute mod0 = new BasicAttribute("userpassword", "secret"); + Attribute mod0 = new BasicAttribute("userpassword", "secret"); //$NON-NLS-1$ //$NON-NLS-2$ // add mobile phone number attribute - Attribute mod1 = new BasicAttribute("mobile", "123-456-1234"); + Attribute mod1 = new BasicAttribute("mobile", "123-456-1234"); //$NON-NLS-1$ //$NON-NLS-2$ mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0); mods[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, mod1); @@ -309,23 +308,23 @@ */ private BasicAttributes getBasicAttributes() { BasicAttributes basicattributes = new BasicAttributes(); - BasicAttribute basicattribute = new BasicAttribute("objectclass"); - basicattribute.add("top"); - basicattribute.add("person"); - basicattribute.add("organizationalPerson"); - basicattribute.add("inetOrgPerson"); + BasicAttribute basicattribute = new BasicAttribute("objectclass"); //$NON-NLS-1$ + basicattribute.add("top"); //$NON-NLS-1$ + basicattribute.add("person"); //$NON-NLS-1$ + basicattribute.add("organizationalPerson"); //$NON-NLS-1$ + basicattribute.add("inetOrgPerson"); //$NON-NLS-1$ basicattributes.put(basicattribute); - String s1 = "User"; - String s3 = "Test"; - String s5 = "user"; - String s6 = "test"; + String s1 = "User"; //$NON-NLS-1$ + String s3 = "Test"; //$NON-NLS-1$ + String s5 = "user"; //$NON-NLS-1$ + String s6 = "test"; //$NON-NLS-1$ counter += 1; - basicattributes.put(new BasicAttribute("givenname", s1)); - basicattributes.put(new BasicAttribute("sn", s3)); - basicattributes.put(new BasicAttribute("cn", "TestUser" + counter)); - basicattributes.put(new BasicAttribute("uid", s5)); - basicattributes.put(new BasicAttribute("userpassword", s6)); - setProperty(new StringProperty(ADD, "cn=TestUser" + counter)); + basicattributes.put(new BasicAttribute("givenname", s1)); //$NON-NLS-1$ + basicattributes.put(new BasicAttribute("sn", s3)); //$NON-NLS-1$ + basicattributes.put(new BasicAttribute("cn", "TestUser" + counter)); //$NON-NLS-1$ //$NON-NLS-2$ + basicattributes.put(new BasicAttribute("uid", s5)); //$NON-NLS-1$ + basicattributes.put(new BasicAttribute("userpassword", s6)); //$NON-NLS-1$ + setProperty(new StringProperty(ADD, "cn=TestUser" + counter)); //$NON-NLS-1$ return basicattributes; } @@ -434,24 +433,24 @@ try { ldap.connect(getServername(), getPort(), getRootdn(), getUsername(), getPassword()); - if (getPropertyAsString(TEST).equals("add")) { + if (getPropertyAsString(TEST).equals(ADD)) { addTest(ldap, res); - } else if (getPropertyAsString(TEST).equals("delete")) { + } else if (getPropertyAsString(TEST).equals(DELETE)) { deleteTest(ldap, res); - } else if (getPropertyAsString(TEST).equals("modify")) { + } else if (getPropertyAsString(TEST).equals(MODIFY)) { modifyTest(ldap, res); - } else if (getPropertyAsString(TEST).equals("search")) { + } else if (getPropertyAsString(TEST).equals(SEARCHBASE)) { searchTest(ldap, res); } // TODO - needs more work ... - if (getPropertyAsString(TEST).equals("search") && !searchFoundEntries) { - res.setResponseCode("201");// TODO is this a sensible number? + if (getPropertyAsString(TEST).equals(SEARCHBASE) && !searchFoundEntries) { + res.setResponseCode("201");// TODO is this a sensible number? //$NON-NLS-1$ res.setResponseMessage("OK - no results"); res.setResponseData("successful - no results".getBytes()); } else { res.setResponseCodeOK(); - res.setResponseMessage("OK"); + res.setResponseMessage("OK"); //$NON-NLS-1$ res.setResponseData("successful".getBytes()); } res.setDataType(SampleResult.TEXT); @@ -461,7 +460,7 @@ // Could time this // res.sampleEnd(); // if sampleEnd() is not called, elapsed time will remain zero - res.setResponseCode("500");// TODO distinguish errors better + res.setResponseCode("500");// TODO distinguish errors better //$NON-NLS-1$ res.setResponseMessage(ex.toString()); isSuccessful = false; } finally { Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapClient.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapClient.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapClient.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapClient.java Sat May 5 16:40:43 2007 @@ -40,7 +40,6 @@ * * @author T.Elanjchezhiyan([EMAIL PROTECTED]) - Sip Technologies and * Exports Ltd. Created Apr 29 2003 11:00 AM - * @version $Revision$ Last updated: $Date$ */ public class LdapClient { transient private static Logger log = LoggingManager.getLoggerForClass(); @@ -59,9 +58,9 @@ public void connect(String host, String port, String rootdn, String username, String password) throws NamingException { Hashtable env = new Hashtable(); - env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); - env.put(Context.PROVIDER_URL, "ldap://" + host + ":" + port + "/" + rootdn); - env.put(Context.REFERRAL, "throw"); + env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); //$NON-NLS-1$ + env.put(Context.PROVIDER_URL, "ldap://" + host + ":" + port + "/" + rootdn); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + env.put(Context.REFERRAL, "throw"); //$NON-NLS-1$ env.put(Context.SECURITY_CREDENTIALS, password); env.put(Context.SECURITY_PRINCIPAL, username); dirContext = new InitialDirContext(env); @@ -91,8 +90,8 @@ */ public boolean searchTest(String searchBase, String searchFilter) throws NamingException { // System.out.println("Base="+searchBase+" Filter="+searchFilter); - SearchControls searchcontrols = new SearchControls(SearchControls.SUBTREE_SCOPE, 1L, // count - // limit + SearchControls searchcontrols = new SearchControls(SearchControls.SUBTREE_SCOPE, + 1L, // count limit 0, // time limit null,// attributes (null = all) false,// return object ? Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapExtClient.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapExtClient.java?view=diff&rev=535574&r1=535573&r2=535574 ============================================================================== --- jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapExtClient.java (original) +++ jakarta/jmeter/branches/rel-2-2/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LdapExtClient.java Sat May 5 16:40:43 2007 @@ -49,6 +49,8 @@ public class LdapExtClient { private static final Logger log = LoggingManager.getLoggerForClass(); + private static final String CONTEXT_IS_NULL = "Context is null"; //TODO should perhaps be a resource + /** * Constructor for the LdapClient object */ @@ -125,7 +127,7 @@ public NamingEnumeration searchTest(DirContext dirContext, String searchBase, String searchFilter, int scope, long countlim, int timelim, String[] attrs, boolean retobj, boolean deref) throws NamingException { if (dirContext == null) { - throw new NamingException("Context is null"); + throw new NamingException(CONTEXT_IS_NULL); } SearchControls searchcontrols = null; searchcontrols = new SearchControls(scope, countlim, timelim, attrs, retobj, deref); @@ -144,7 +146,7 @@ **************************************************************************/ public NamingEnumeration compare(DirContext dirContext, String filter, String entrydn) throws NamingException { if (dirContext == null) { - throw new NamingException("Context is null"); + throw new NamingException(CONTEXT_IS_NULL); } SearchControls searchcontrols = new SearchControls(0, 1, 0, new String[0], false, false); return dirContext.search(entrydn, filter, searchcontrols); @@ -161,7 +163,7 @@ public void moddnOp(DirContext dirContext, String ddn, String newdn) throws NamingException { log.debug("ddn and newDn= " + ddn + "@@@@" + newdn); if (dirContext == null) { - throw new NamingException("Context is null"); + throw new NamingException(CONTEXT_IS_NULL); } dirContext.rename(ddn, newdn); } @@ -176,7 +178,7 @@ **************************************************************************/ public void modifyTest(DirContext dirContext, ModificationItem[] mods, String string) throws NamingException { if (dirContext == null) { - throw new NamingException("Context is null"); + throw new NamingException(CONTEXT_IS_NULL); } dirContext.modifyAttributes(string, mods); @@ -193,7 +195,7 @@ public DirContext createTest(DirContext dirContext, Attributes attributes, String string) throws NamingException { if (dirContext == null) { - throw new NamingException("Context is null"); + throw new NamingException(CONTEXT_IS_NULL); } return dirContext.createSubcontext(string, attributes); } @@ -206,7 +208,7 @@ **************************************************************************/ public void deleteTest(DirContext dirContext, String string) throws NamingException { if (dirContext == null) { - throw new NamingException("Context is null"); + throw new NamingException(CONTEXT_IS_NULL); } dirContext.destroySubcontext(string); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]