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

Fabio Pistolesi
15.35.2015 2f7e7e51a205dfa483bd5bb82d90e4ec5719ab9e
OPENDJ-1978 CR-6931 Setup: enable replication 3.0 to 2.6 should not propose to replicate dc=replicationChanges

Even though dc=replicationChanges does not exist anymore in trunk, it should still be referenced in the tools in order to be filtered out.
We should also prevent it from being specified as argument for dsreplication.
5 files modified
33 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java 3 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/messages/org/opends/messages/admin_tool.properties 2 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java
@@ -65,6 +65,9 @@
  /** DN of the schema object. */
  public static final String SCHEMA_DN = "cn=schema";
  /** DN of legacy replication changes base DN for backwards compatibility with OpenDJ <= 2.6.x. */
  public static final String REPLICATION_CHANGES_DN = "dc=replicationChanges";
  /** The cli java system property. */
  public static final String CLI_JAVA_PROPERTY = "org.opends.quicksetup.cli";
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
@@ -224,7 +224,8 @@
      {
        if (!Utils.areDnsEqual(suffix.getDN(),
            ADSContext.getAdministrationSuffixDN()) &&
            !Utils.areDnsEqual(suffix.getDN(), Constants.SCHEMA_DN))
            !Utils.areDnsEqual(suffix.getDN(), Constants.SCHEMA_DN) &&
            !Utils.areDnsEqual(suffix.getDN(), Constants.REPLICATION_CHANGES_DN))
        {
          orderedSuffixes.add(suffix);
        }
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -336,6 +336,10 @@
        {
          errors.add(ERR_REPLICATION_NOT_A_VALID_BASEDN.get(dn));
        }
        if (dn.equalsIgnoreCase(Constants.REPLICATION_CHANGES_DN))
        {
          errors.add(ERR_REPLICATION_NOT_A_USER_SUFFIX.get(Constants.REPLICATION_CHANGES_DN));
        }
      }
    }
    if (errors.size() > 0)
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -1709,7 +1709,7 @@
  {
    for (String suffix : suffixes)
    {
      if (!isSchemaOrAdminSuffix(suffix))
      if (!isSchemaOrInternalAdminSuffix(suffix))
      {
        return false;
      }
@@ -1717,10 +1717,11 @@
    return true;
  }
  private boolean isSchemaOrAdminSuffix(String suffix)
  private boolean isSchemaOrInternalAdminSuffix(String suffix)
  {
    return areDnsEqual(suffix, ADSContext.getAdministrationSuffixDN())
        || areDnsEqual(suffix, Constants.SCHEMA_DN);
        || areDnsEqual(suffix, Constants.SCHEMA_DN)
        || areDnsEqual(suffix,  Constants.REPLICATION_CHANGES_DN);
  }
  /**
@@ -4723,7 +4724,7 @@
  {
    for (String dn : availableSuffixes)
    {
      if (!isSchemaOrAdminSuffix(dn))
      if (!isSchemaOrInternalAdminSuffix(dn))
      {
        try
        {
@@ -4871,7 +4872,7 @@
            for (String dn : availableSuffixes)
            {
              if (!isSchemaOrAdminSuffix(dn))
              if (!isSchemaOrInternalAdminSuffix(dn))
              {
                boolean addSuffix;
                try
@@ -5715,7 +5716,7 @@
      for (SuffixDescriptor suffix : cache.getSuffixes())
      {
        if (isSchemaOrAdminSuffix(suffix.getDN()))
        if (isSchemaOrInternalAdminSuffix(suffix.getDN()))
        {
          // Do not display these suffixes.
          continue;
@@ -5742,7 +5743,7 @@
        Set<String> baseDNs = new LinkedHashSet<String>();
        for (SuffixDescriptor suffix : beforeLastRepServer)
        {
          if (!isSchemaOrAdminSuffix(suffix.getDN()))
          if (!isSchemaOrInternalAdminSuffix(suffix.getDN()))
          {
            // Do not display these suffixes.
            baseDNs.add(suffix.getDN());
@@ -5775,8 +5776,7 @@
          boolean baseDNSpecified = false;
          for (String baseDN : uData.getBaseDNs())
          {
            if (!isSchemaOrAdminSuffix(baseDN)
                && areDnsEqual(baseDN, suffix.getDN()))
            if (!isSchemaOrInternalAdminSuffix(baseDN) && areDnsEqual(baseDN, suffix.getDN()))
            {
              baseDNSpecified = true;
              break;
@@ -6110,8 +6110,7 @@
      // If no base DNs where specified display all the base DNs but the schema
      // and cn=admin data.
      boolean found = containsDN(userBaseDNs, dn)
          || (displayAll && !isSchemaOrAdminSuffix(dn));
      boolean found = containsDN(userBaseDNs, dn) || (displayAll && !isSchemaOrInternalAdminSuffix(dn));
      if (found)
      {
        boolean replicated = false;
opendj-server-legacy/src/messages/org/opends/messages/admin_tool.properties
@@ -521,6 +521,8 @@
 provide it using the %s or the %s options.
ERR_REPLICATION_NOT_A_VALID_BASEDN=The provided value %s is not a valid \
 base DN.
ERR_REPLICATION_NOT_A_USER_SUFFIX=The administrative base DN '%s' cannot \
 be replicated. Please provide a base DN that contains user data.
ERR_REPLICATION_ENABLE_SAME_SERVER_PORT=You have to provide two \
 different servers to enable replication.  You have provided twice the server \
 %s:%s