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

neil_a_wilson
14.48.2007 c991a7c7d91551411804ad719134e869bc108d47
Add some missing package-info.java files, and add a unit test to ensure that
these files are properly created from now on.
8 files added
666 ■■■■■ changed files
opends/src/build-tools/javax/jnlp/package-info.java 38 ●●●●● patch | view | raw | blame | history
opends/src/build-tools/org/opends/build/tools/package-info.java 36 ●●●●● patch | view | raw | blame | history
opends/src/dsml/org/opends/dsml/protocol/package-info.java 37 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/package-info.java 37 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/synchronization/plugin/package-info.java 38 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/localbackend/package-info.java 36 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/package-info.java 36 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/util/PackageInfoTestCase.java 408 ●●●●● patch | view | raw | blame | history
opends/src/build-tools/javax/jnlp/package-info.java
New file
@@ -0,0 +1,38 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * This package provides a set of source file stubs for files that are part of
 * the javax.jnlp package and are needed in order to build QuickSetup (and
 * potentially other utilities accessible via Java Web Start).  This code is not
 * actually used in any way other than to allow other code to compile, nor
 * should it be included in any JAR files or other bundles that we ship.
 */
package javax.jnlp;
opends/src/build-tools/org/opends/build/tools/package-info.java
New file
@@ -0,0 +1,36 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * This package contains source for a number of tools that are used in some way
 * during the OpenDS build process.  This includes custom Ant tasks, utilities
 * to format schema files, and to facilitate running server unit tests.
 */
package org.opends.build.tools;
opends/src/dsml/org/opends/dsml/protocol/package-info.java
New file
@@ -0,0 +1,37 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * This package contains source for a Web application that may be used as a
 * DSML-to-LDAP gateway.  It accepts requests from DSMLv2 clients, forwards them
 * as LDAPv3 requests to a directory server, and converts the LDAPv3 response
 * back to a DSMLv2 response that is sent back to the client.
 */
package org.opends.dsml.protocol;
opends/src/server/org/opends/server/admin/client/cli/package-info.java
New file
@@ -0,0 +1,37 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * Command-line interface code for common client-side administration classes.
 * <p>
 * This package contains classes which client applications and client-side
 * driver implementations are expected to use for their command-line interfaces.
 */
package org.opends.server.admin.client.cli;
opends/src/server/org/opends/server/synchronization/plugin/package-info.java
New file
@@ -0,0 +1,38 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * This package contains a matching rule needed for legacy support for a
 * comparator needed by a replication changelog database that used older
 * versions of the synchronization plugin.  The classes in this package are
 * only provided for historical reasons, and all active code can be found in the
 * org.opends.server.replication package and its sub-packages.
 */
package org.opends.server.synchronization.plugin;
opends/src/server/org/opends/server/workflowelement/localbackend/package-info.java
New file
@@ -0,0 +1,36 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * This package contains source for the local backend workflow element, which
 * are used to process operations against data stored in local backend databases
 * and other repositories that are considered "local".
 */
package org.opends.server.workflowelement.localbackend;
opends/src/server/org/opends/server/workflowelement/package-info.java
New file
@@ -0,0 +1,36 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
/**
 * This package contains source for workflow elements used within the server.
 * Different kinds of workflow elements are needed for different server roles
 * (e.g., local data storage, proxy/distribution/virtual access, etc.).
 */
package org.opends.server.workflowelement;
opends/tests/unit-tests-testng/src/server/org/opends/server/util/PackageInfoTestCase.java
New file
@@ -0,0 +1,408 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.util;
import java.io.File;
import java.util.ArrayList;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import static org.testng.Assert.*;
/**
 * This class provides a test case that can be used to ensure that all source
 * packages also include a package-info.java file with javadoc and annotation
 * information about that package.
 */
public class PackageInfoTestCase
       extends UtilTestCase
{
  // The directory that serves as the top-level source root.
  private File sourceRoot;
  /**
   * Ensure that the source root directories are initialized properly.
   */
  @BeforeClass()
  public void setUp()
  {
    String rootDir = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
    assertNotNull(rootDir);
    File buildRoot = new File(rootDir);
    assertTrue(buildRoot.exists());
    sourceRoot = new File(buildRoot, "src");
    assertTrue(sourceRoot.exists());
  }
  /**
   * Retrieves a set of File objects that point to directories that contain ADS
   * source.
   *
   * @return  A set of File objects that point to directories that contain ADS
   *          source.
   */
  @DataProvider(name = "adsSourceDirectories")
  public Object[][] getADSSourceDirectories()
  {
    File adsSourceRoot = new File(sourceRoot, "ads");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(adsSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Retrieves a set of File objects that point to directories that contain
   * admin source.
   *
   * @return  A set of File objects that point to directories that contain
   *          admin source.
   */
  @DataProvider(name = "adminSourceDirectories")
  public Object[][] getAdminSourceDirectories()
  {
    File adminSourceRoot = new File(sourceRoot, "admin");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(adminSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Retrieves a set of File objects that point to directories that contain
   * build tools source.
   *
   * @return  A set of File objects that point to directories that contain build
   *          tools source.
   */
  @DataProvider(name = "buildToolsSourceDirectories")
  public Object[][] getBuildToolsSourceDirectories()
  {
    File buildToolsSourceRoot = new File(sourceRoot, "build-tools");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(buildToolsSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Retrieves a set of File objects that point to directories that contain
   * DSML gateway source.
   *
   * @return  A set of File objects that point to directories that contain
   *          DSML gateway source.
   */
  @DataProvider(name = "dsmlSourceDirectories")
  public Object[][] getDSMLSourceDirectories()
  {
    File dsmlSourceRoot = new File(sourceRoot, "dsml");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(dsmlSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Retrieves a set of File objects that point to directories that contain
   * GUI tools source.
   *
   * @return  A set of File objects that point to directories that contain
   *          GUI tools source.
   */
  @DataProvider(name = "guiToolsSourceDirectories")
  public Object[][] getGUIToolsSourceDirectories()
  {
    File guiToolsSourceRoot = new File(sourceRoot, "guitools");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(guiToolsSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Retrieves a set of File objects that point to directories that contain
   * QuickSetup source.
   *
   * @return  A set of File objects that point to directories that contain
   *          server source.
   */
  @DataProvider(name = "quickSetupSourceDirectories")
  public Object[][] getQuickSetupSourceDirectories()
  {
    File quickSetupSourceRoot = new File(sourceRoot, "quicksetup");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(quickSetupSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Retrieves a set of File objects that point to directories that contain
   * server source.
   *
   * @return  A set of File objects that point to directories that contain
   *          server source.
   */
  @DataProvider(name = "serverSourceDirectories")
  public Object[][] getServerSourceDirectories()
  {
    File serverSourceRoot = new File(sourceRoot, "server");
    ArrayList<File> sourceDirs = new ArrayList<File>();
    getSourceDirectories(serverSourceRoot, sourceDirs);
    Object[][] returnArray = new Object[sourceDirs.size()][1];
    for (int i=0; i < returnArray.length; i++)
    {
      returnArray[i][0] = sourceDirs.get(i);
    }
    return returnArray;
  }
  /**
   * Recursively descends the filesystem structure, identifying directories that
   * contain Java source code and adding them to the provided list.
   *
   * @param  startingPoint      The directory that marks the starting point at
   *                            which to begin.
   * @param  sourceDirectories  The list of identified source directories, to
   *                            which any new source directories will be added.
   */
  private void getSourceDirectories(File startingPoint,
                                    ArrayList<File> sourceDirectories)
  {
    boolean added = false;
    for (File f : startingPoint.listFiles())
    {
      if (f.isDirectory())
      {
        if (! f.getName().equals(".svn"))
        {
          getSourceDirectories(f, sourceDirectories);
        }
      }
      else if (f.isFile() && f.getName().endsWith(".java"))
      {
        if (! added)
        {
          sourceDirectories.add(startingPoint);
          added = true;
        }
      }
    }
  }
  /**
   * Ensure that all ADS source file packages include a package-info.java
   * file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(enabled=false, dataProvider="adsSourceDirectories")
  public void testADSPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that all admin source file packages include a package-info.java
   * file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(dataProvider="adminSourceDirectories")
  public void testAdminPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that all build tools source file packages include a
   * package-info.java file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(dataProvider="buildToolsSourceDirectories")
  public void testBuildToolsPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that all DSML gateway source file packages include a
   * package-info.java file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(dataProvider="dsmlSourceDirectories")
  public void testDSMLPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that all GUI tools source file packages include a package-info.java
   * file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(enabled=false, dataProvider="guiToolsSourceDirectories")
  public void testGUIToolsPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that all QuickSetup source file packages include a package-info.java
   * file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(enabled=false, dataProvider="quickSetupSourceDirectories")
  public void testQuickSetupPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that all server source file packages include a package-info.java
   * file.
   *
   * @param  sourceDirectory  The directory for which to make the determination.
   */
  @Test(dataProvider="serverSourceDirectories")
  public void testServerPackageInfoExists(File sourceDirectory)
         throws Exception
  {
    checkPackageInfoFileExistsInternal(sourceDirectory);
  }
  /**
   * Ensure that the provided source directory contains a package-info.java
   * file.
   *
   * @param  sourceDirectory  The directory in which to verify the existence of
   *                          a package-info.java file.
   */
  private void checkPackageInfoFileExistsInternal(File sourceDirectory)
  {
    assertTrue(sourceDirectory.exists());
    assertTrue(sourceDirectory.isDirectory());
    File packageInfoFile = new File(sourceDirectory, "package-info.java");
    assertTrue(packageInfoFile.exists(),
               "Source directory " + sourceDirectory.getAbsolutePath() +
               " does not contain a package-info.java file.");
  }
}