mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
10.17.2009 a73afe1b71b62386dbf5f463571a54f8b0bca9a1
Fix org.opends.messages.PropertiesFilesTest unit test failure - remove duplicate messages.

Also fix compilation warnings in ConnectionHandlerMonitoringPanel.
5 files modified
95 ■■■■ changed files
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java 12 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java 14 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/messages/messages/admin_tool.properties 7 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/messages/PropertiesFilesTest.java 46 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
@@ -85,7 +85,7 @@
  private Message NO_ELEMENT_SELECTED =
    INFO_CTRL_PANEL_GENERAL_MONITORING_NO_ITEM_SELECTED.get();
  private Message MULTIPLE_ITEMS_SELECTED =
    INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED.get();
    INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED_LABEL.get();
  /**
   * The enumeration used to define the different static nodes of the tree.
@@ -137,6 +137,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean requiresBorder()
  {
    return false;
@@ -145,6 +146,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean requiresScroll()
  {
    return false;
@@ -153,6 +155,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean callConfigurationChangedInBackground()
  {
    return true;
@@ -161,6 +164,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void toBeDisplayed(boolean visible)
  {
    ((GenericDialog)Utilities.getParentDialog(this)).getRootPane().
@@ -195,6 +199,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Message getTitle()
  {
    return INFO_CTRL_PANEL_GENERAL_MONITORING_TITLE.get();
@@ -203,6 +208,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Component getPreferredFocusComponent()
  {
    return treePane;
@@ -211,6 +217,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void okClicked()
  {
    // No ok button
@@ -219,6 +226,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public GenericDialog.ButtonType getButtonType()
  {
    return GenericDialog.ButtonType.CLOSE;
@@ -294,6 +302,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void setInfo(ControlPanelInfo info)
  {
    super.setInfo(info);
@@ -622,6 +631,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value,
        boolean isSelected, boolean isExpanded, boolean isLeaf, int row,
        boolean hasFocus)
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
@@ -184,7 +184,7 @@
  private Message CATEGORY_ITEM_SELECTED =
    INFO_CTRL_PANEL_CATEGORY_ITEM_SELECTED.get();
  private Message MULTIPLE_ITEMS_SELECTED =
    INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED.get();
    INFO_CTRL_PANEL_MULTIPLE_SCHEMA_ITEMS_SELECTED.get();
  /**
   * Default constructor.
@@ -199,6 +199,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean requiresBorder()
  {
    return false;
@@ -207,6 +208,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean requiresScroll()
  {
    return false;
@@ -215,6 +217,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean callConfigurationChangedInBackground()
  {
    return true;
@@ -223,6 +226,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void toBeDisplayed(boolean visible)
  {
    ((GenericDialog)Utilities.getParentDialog(this)).getRootPane().
@@ -316,6 +320,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public void keyReleased(KeyEvent e)
      {
        if ((e.getKeyCode() == KeyEvent.VK_ENTER) && applyButton.isEnabled())
@@ -421,6 +426,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Message getTitle()
  {
    return INFO_CTRL_PANEL_MANAGE_SCHEMA_TITLE.get();
@@ -429,6 +435,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Component getPreferredFocusComponent()
  {
    return filter;
@@ -437,6 +444,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void closeClicked()
  {
    setSecondaryValid(lFilter);
@@ -446,6 +454,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void okClicked()
  {
    // No ok button
@@ -454,6 +463,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public GenericDialog.ButtonType getButtonType()
  {
    return GenericDialog.ButtonType.NO_BUTTON;
@@ -599,6 +609,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void setInfo(ControlPanelInfo info)
  {
    super.setInfo(info);
@@ -1807,6 +1818,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value,
        boolean isSelected, boolean isExpanded, boolean isLeaf, int row,
        boolean hasFocus)
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java
@@ -76,8 +76,6 @@
import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor.
 State;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.ui.StatusGenericPanel.
 IgnoreItemListener;
import org.opends.guitools.controlpanel.ui.renderer.CustomListCellRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.guitools.controlpanel.util.ViewPositions;
@@ -259,6 +257,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Message getTitle()
  {
    return INFO_CTRL_PANEL_CONNECTION_HANDLER_MONITORING_TITLE.get();
@@ -267,6 +266,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public JMenuBar getMenuBar()
  {
    if (menuBar == null)
@@ -397,6 +397,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Component getPreferredFocusComponent()
  {
    return connectionHandlers;
@@ -405,6 +406,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void okClicked()
  {
    // No ok button
@@ -413,6 +415,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public GenericDialog.ButtonType getButtonType()
  {
    return GenericDialog.ButtonType.CLOSE;
@@ -422,6 +425,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean requiresBorder()
  {
    return false;
@@ -430,6 +434,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean requiresScroll()
  {
    return false;
@@ -542,7 +547,7 @@
          {
            if (ch.getProtocol() != Protocol.LDIF)
            {
              cchs.add((ConnectionHandlerDescriptor)ch);
              cchs.add(ch);
            }
          }
          cchs.add(server.getAdminConnector());
@@ -554,7 +559,7 @@
          {
            if (getConnectionHandlerLabel(ch).equals(name))
            {
              cchs.add((ConnectionHandlerDescriptor)ch);
              cchs.add(ch);
              break;
            }
          }
@@ -593,6 +598,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    protected void addMenus()
    {
      add(createViewMenuBar());
@@ -603,6 +609,7 @@
     * Creates the view menu bar.
     * @return the view menu bar.
     */
    @Override
    protected JMenu createViewMenuBar()
    {
      JMenu menu = Utilities.createMenu(
@@ -655,6 +662,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public Component getListCellRendererComponent(JList list, Object value,
        int index, boolean isSelected, boolean cellHasFocus)
    {
opendj-sdk/opends/src/messages/messages/admin_tool.properties
@@ -1430,7 +1430,7 @@
INFO_CTRL_PANEL_NO_SCHEMA_ITEM_SELECTED=No Schema Item Selected
INFO_CTRL_PANEL_CATEGORY_ITEM_SELECTED=Category Item Selected
INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED=Multiple Schema Items Selected
INFO_CTRL_PANEL_MULTIPLE_SCHEMA_ITEMS_SELECTED=Multiple Schema Items Selected
MILD_ERR_CANNOT_DELETE_PARENT_OBJECTCLASS=ObjectClass '%s' is superior of the \
 following classes: %s.  You must redefine these classes so that they do not \
@@ -2327,8 +2327,7 @@
INFO_CTRL_PANEL_CATEGORY_MONITORING=Monitoring
INFO_CTRL_PANEL_BROWSE_GENERAL_MONITORING=General Information
INFO_CTRL_PANEL_GENERAL_MONITORING_NO_ITEM_SELECTED=-No Item Selected-
INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED=-Multiple Items Selected-
INFO_CTRL_PANEL_GENERAL_MONITORING_NO_ITEM_SELECTED=- No Item Selected -
INFO_CTRL_PANEL_GENERAL_MONITORING_TITLE=General Information
INFO_CTRL_PANEL_AUTH_REQUIRED_TO_BROWSE_MONITORING_SUMMARY=The server is \
 running.  You must provide authentication to see the monitoring data.
@@ -2425,7 +2424,5 @@
 for the Connection Handler Monitoring
INFO_CTRL_PANEL_SHOW_AVERAGES=Show Averages
INFO_CTRL_PANEL_CONNECTION_HANDLER_HEADER=Connection Handler
INFO_CTRL_PANEL_ADMINISTRATION_CONNECTOR_NAME=%d - Administration \
 Connector
INFO_CTRL_PANEL_CONNECTION_HANDLER_MONITORING=Connection Handler
INFO_CTRL_PANEL_AVERAGE_HEADER=%s Avg per second
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/messages/PropertiesFilesTest.java
@@ -22,12 +22,14 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.messages;
import org.opends.server.TestCaseUtils;
import org.opends.server.util.StaticUtils;
import static org.testng.Assert.*;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -37,6 +39,8 @@
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
@@ -46,6 +50,10 @@
 */
public class PropertiesFilesTest extends MessagesTestCase {
  /**
   * Creates date for testForDuplicateKeys.
   * @return The test data.
   */
  @DataProvider(name = "messagePropertiesFiles")
  public Object[][] getMessagePropertiesFiles() {
    File propFilesDir = getPropertiesFilesDirectory();
@@ -73,24 +81,40 @@
   * @throws IOException if problems reading the file
   */
  @Test(dataProvider = "messagePropertiesFiles")
  public void testForDuplicateKeys(File propertiesFile) throws IOException {
  public void testForDuplicateKeys(File propertiesFile)
      throws IOException
  {
    Set<String> keys = new HashSet<String>();
    BufferedReader reader = new BufferedReader(new FileReader(propertiesFile));
    BufferedReader reader =
        new BufferedReader(new FileReader(propertiesFile));
    List<String> errors = new LinkedList<String>();
    String prevLine = null;
    String line;
    while (null != (line = reader.readLine())) {
      if (!(prevLine == null || prevLine.endsWith("\\")) && // not a value continuation
          !(line.startsWith("#")) && // not a comment
          (line.indexOf('=') > 0)) { // defines a key
    while (null != (line = reader.readLine()))
    {
      if (!(prevLine == null || prevLine.endsWith("\\")) // not a value continuation
          && !(line.startsWith("#")) // not a comment
          && (line.indexOf('=') > 0))
      {
        // defines a key
        String key = line.substring(0, line.indexOf('='));
        assertFalse(keys.contains(key),
                "Key " + key + " is defined multiple places in " +
                        propertiesFile.getName());
        keys.add(key);
        if (keys.contains(key))
        {
          errors.add(key);
        }
        else
        {
          keys.add(key);
        }
      }
      prevLine = line;
    }
    assertTrue(errors.isEmpty(),
        "The following keys are defined multiple times in "
            + propertiesFile.getName() + ":" + EOL
            + StaticUtils.listToString(errors, EOL));
  }
  private File getPropertiesFilesDirectory() {