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

lutoff
27.50.2007 5f5b90916e9743cee0386499d83a6c673f768f5e
fix for issue #1809 (Avoid operands wherever possible)

this commit is for hidden subcommand
4 files modified
65 ■■■■ changed files
opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliAds.java 33 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/messages/AdminMessages.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ToolConstants.java 15 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliAds.java
@@ -39,6 +39,7 @@
import org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.ReturnCode;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
import org.opends.server.util.args.SubCommand;
import org.opends.server.util.args.SubCommandArgumentParser;
@@ -102,11 +103,21 @@
  public SubCommand createAdsSubCmd;
  /**
   * The 'backend-name' argument of the 'create-ads' subcommand.
   */
  private StringArgument createAdsBackendNameArg;
  /**
   * The 'delete-ads' subcommand.
   */
  private SubCommand deleteAdsSubCmd;
  /**
   * The 'backend-name' argument of the 'delete-ads' subcommand.
   */
  private StringArgument deleteAdsBackendNameArg;
  /**
   * {@inheritDoc}
   */
  public void initializeCliGroup(SubCommandArgumentParser argParser,
@@ -115,15 +126,25 @@
  {
    // Create-ads subcommand
    createAdsSubCmd = new SubCommand(argParser, SubCommandNameEnum.CREATE_ADS
        .toString(), true, 1, 1, OPERAND_BACKEND,
        MSGID_ADMIN_SUBCMD_CREATE_ADS_DESCRIPTION);
        .toString(), MSGID_ADMIN_SUBCMD_CREATE_ADS_DESCRIPTION);
    createAdsSubCmd.setHidden(true);
    createAdsBackendNameArg = new StringArgument("backendName",
        OPTION_SHORT_BACKENDNAME, OPTION_LONG_BACKENDNAME, true, true,
        OPTION_VALUE_BACKENDNAME,
        MSGID_ADMIN_ARG_BACKENDNAME_DESCRIPTION);
    createAdsSubCmd.addArgument(createAdsBackendNameArg);
    // delete-ads
    deleteAdsSubCmd = new SubCommand(argParser,SubCommandNameEnum.DELETE_ADS
        .toString(),  true, 1, 1, OPERAND_BACKEND,
        MSGID_ADMIN_SUBCMD_DELETE_ADS_DESCRIPTION);
        .toString(), MSGID_ADMIN_SUBCMD_DELETE_ADS_DESCRIPTION);
    deleteAdsSubCmd.setHidden(true);
    deleteAdsBackendNameArg = new StringArgument("backendName",
        OPTION_SHORT_BACKENDNAME, OPTION_LONG_BACKENDNAME, true, true,
        OPTION_VALUE_BACKENDNAME,
        MSGID_ADMIN_ARG_BACKENDNAME_DESCRIPTION);
    deleteAdsSubCmd.addArgument(deleteAdsBackendNameArg);
  }
  /**
@@ -146,13 +167,13 @@
    // create-ads subcommand
    if (subCmd.getName().equals(createAdsSubCmd.getName()))
    {
      String backendName = subCmd.getTrailingArguments().get(0);
      String backendName = createAdsBackendNameArg.getValue();
      adsContext.createAdminData(backendName);
      return ReturnCode.SUCCESSFUL;
    }
    else if (subCmd.getName().equals(deleteAdsSubCmd.getName()))
    {
      String backendName = subCmd.getTrailingArguments().get(0);
      String backendName = deleteAdsBackendNameArg.getValue();
      ADSContextHelper helper = new ADSContextHelper();
      helper.removeAdministrationSuffix(adsContext.getDirContext(),
          backendName);
opends/src/server/org/opends/server/messages/AdminMessages.java
@@ -475,6 +475,14 @@
   */
  public static final int MSGID_ADMIN_ARG_MEMBERNAME_DESCRIPTION =
    CATEGORY_MASK_ADMIN | SEVERITY_MASK_INFORMATIONAL | 55;
  /**
   * The message ID for the message that will be used as the description of the
   * "backend-name" argument.  This does take one argument.
   */
  public static final int MSGID_ADMIN_ARG_BACKENDNAME_DESCRIPTION =
    CATEGORY_MASK_ADMIN | SEVERITY_MASK_INFORMATIONAL | 56;
  // Prevent instantiation.
  private AdminMessages() {
    // Do nothing.
@@ -644,7 +652,10 @@
    registerMessage(MSGID_ADMIN_ARG_GROUPNAME_DESCRIPTION,
       "The group's identifier. This is a required argument");
    registerMessage(MSGID_ADMIN_ARG_MEMBERNAME_DESCRIPTION,
    "The member's identifier. This is a required argument");
       "The member's identifier. This is a required argument");
    registerMessage(MSGID_ADMIN_ARG_BACKENDNAME_DESCRIPTION,
        "The backen name is which the admin data will be registered. " +
        "This is a required argument");
  }
}
opends/src/server/org/opends/server/tools/ToolConstants.java
@@ -571,9 +571,20 @@
  public static final String OPTION_VALUE_MEMBERNAME = "{member-name}";
  /**
   * The placeholder value of backend name that will be
   * The value for the short option backendName attributes.
   */
  public static final char OPTION_SHORT_BACKENDNAME = 'b';
  /**
   * The value for the long option backendName
   * attribute.
   */
  public static final String OPTION_LONG_BACKENDNAME= "backendName";
  /**
   * The placeholder value of backendName that will be
   * displayed in usage information.
   */
  public static final String OPERAND_BACKEND = "BACKEND_NAME";
  public static final String OPTION_VALUE_BACKENDNAME = "{backend-name}";
}
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java
@@ -88,7 +88,7 @@
      "create-ads",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-w", "password",
      "admin"
      "--backendName", "admin"
    };
    assertEquals(DsFrameworkCliMain.mainCLI(args, false, System.out,
@@ -108,7 +108,7 @@
      "delete-ads",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-w", "password",
      "admin"
      "--backendName", "admin"
    };
    assertEquals(DsFrameworkCliMain.mainCLI(args, false, System.out,