From 828eab7603668c70d56b87ea5eb27caf24368f67 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 13 Nov 2013 11:20:24 +0000
Subject: [PATCH] replication*.properties: Added more info for ERR_INVALID_COOKIE_SYNTAX.
---
opendj-sdk/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java | 40 ++++++++++++++++++++--------------------
opendj-sdk/opends/src/messages/messages/replication_de.properties | 2 +-
opendj-sdk/opends/src/messages/messages/replication.properties | 2 +-
opendj-sdk/opends/src/messages/messages/replication_es.properties | 2 +-
opendj-sdk/opends/src/messages/messages/replication_fr.properties | 2 +-
opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties | 1 -
opendj-sdk/opends/src/messages/messages/replication_ja.properties | 1 -
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java | 6 +++---
8 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/opendj-sdk/opends/src/messages/messages/replication.properties b/opendj-sdk/opends/src/messages/messages/replication.properties
index f010c55..6a276da 100644
--- a/opendj-sdk/opends/src/messages/messages/replication.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication.properties
@@ -338,7 +338,7 @@
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Full resync \
required. Reason: The provided cookie is older than the start of historical \
in the server for the replicated domain : %s
-SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Invalid syntax of the provided cookie
+SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Invalid syntax for the provided cookie '%s'
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Domain %s (server id: %s) : \
remote exporter server disconnection (server id: %s ) detected during \
initialization
diff --git a/opendj-sdk/opends/src/messages/messages/replication_de.properties b/opendj-sdk/opends/src/messages/messages/replication_de.properties
index d4df7be..b5a190b 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_de.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_de.properties
@@ -179,7 +179,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=Fehler in %s beim Aktivieren des externen \u00c4nderungsprotokolls: %s
SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Vollst\u00e4ndige Neusynchronisierung erforderlich. Ursache: Das angegebene Cookie enth\u00e4lt eine unbekannte replizierte Dom\u00e4ne %s. Aktuelle ab Cookie ist <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Vollst\u00e4ndige Neusynchronisierung erforderlich. Ursache: Das angegebene Cookie ist \u00e4lter als der Verlaufsstart im Server f\u00fcr die replizierte Dom\u00e4ne : %s
-SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Ung\u00fcltige Syntax des angegebenen Cookies
+SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Ung\u00fcltige Syntax des angegebenen Cookies '%s'
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Dom\u00e4ne %s (Server-ID: %s) : Trennung vom Exporter-Server (Server-ID: %s ) w\u00e4hrend der Initialisierung
SEVERE_ERR_INIT_IMPORT_FAILURE_190=W\u00e4hrend der Initialisierung von einem Remote-Server ist der folgende Fehler aufgetreten: %s
SEVERE_ERR_INIT_RS_DISCONNECTION_DURING_IMPORT_191=Verbindungsfehler mit Replikationsserver %s w\u00e4hrend Import
diff --git a/opendj-sdk/opends/src/messages/messages/replication_es.properties b/opendj-sdk/opends/src/messages/messages/replication_es.properties
index 8d58b53..5c1e18e 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_es.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_es.properties
@@ -179,7 +179,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=Error en %s al habilitar el registro de cambios externo: %s
SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Se requiere una resincronizaci\u00f3n completa. Raz\u00f3n: la cookie proporcionada contiene un dominio repetido desconocido %s. La cookie actual de partida es <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Se requiere una resincronizaci\u00f3n completa. Raz\u00f3n: la cookie proporcionada es anterior al inicio del hist\u00f3rico en el servidor para el dominio repetido: %s
-SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=La sintaxis de la cookie proporcionada no es v\u00e1lida
+SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=La sintaxis de la cookie proporcionada '%s' no es v\u00e1lida
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Dominio %s (Id. de servidor: %s) : se ha detectado la desconexi\u00f3n del servidor del exportador remoto (Id. de servidor: %s ) durante la inicializaci\u00f3n
SEVERE_ERR_INIT_IMPORT_FAILURE_190=Durante la inicializaci\u00f3n desde un servidor remoto, se ha producido el siguiente error: %s
SEVERE_ERR_INIT_RS_DISCONNECTION_DURING_IMPORT_191=Error de conexi\u00f3n con el Servidor de repetici\u00f3n %s durante la importaci\u00f3n
diff --git a/opendj-sdk/opends/src/messages/messages/replication_fr.properties b/opendj-sdk/opends/src/messages/messages/replication_fr.properties
index 09fa8b8..9cad4b2 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_fr.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_fr.properties
@@ -179,7 +179,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=Erreur de %s lors de l'activation du journal des modifications externe\u00a0: %s
SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Resynchronisation compl\u00e8te requise. Raison\u00a0: le cookie fourni contient un domaine r\u00e9pliqu\u00e9 inconnu (%s). Le cookie actuel de base est <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Resynchronisation compl\u00e8te requise. Raison\u00a0: le cookie fourni est plus ancien que le d\u00e9but de l'historique sur le serveur pour le domaine r\u00e9pliqu\u00e9\u00a0: %s
-SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Syntaxe incorrecte pour le cookie fourni
+SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Syntaxe incorrecte pour le cookie fourni '%s'
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Domaine %s (ID de serveur\u00a0: %s)\u00a0: d\u00e9connexion du serveur d'exportation distant (ID de serveur : %s) d\u00e9tect\u00e9e lors de l'initialisation
SEVERE_ERR_INIT_IMPORT_FAILURE_190=L'erreur suivante s'est produite lors de l'initialisation \u00e0 partir d'un serveur distant : %s
SEVERE_ERR_INIT_RS_DISCONNECTION_DURING_IMPORT_191=\u00c9chec de la connexion au serveur de r\u00e9plication %s lors de l'importation
diff --git a/opendj-sdk/opends/src/messages/messages/replication_ja.properties b/opendj-sdk/opends/src/messages/messages/replication_ja.properties
index 59b205a..1f7a91b 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_ja.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_ja.properties
@@ -179,7 +179,6 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=\u5916\u90e8\u66f4\u65b0\u5c65\u6b74\u30ed\u30b0\u3092\u6709\u52b9\u306b\u3059\u308b\u3068\u304d\u306b\u3001%s \u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: %s
SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=\u5b8c\u5168\u306a\u518d\u540c\u671f\u304c\u5fc5\u8981\u3067\u3059\u3002\u7406\u7531: \u63d0\u4f9b\u3055\u308c\u305f Cookie \u306b\u542b\u307e\u308c\u308b\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30c8\u3055\u308c\u305f\u30c9\u30e1\u30a4\u30f3 %s \u304c\u4e0d\u660e\u3067\u3059\u3002Cookie <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=\u5b8c\u5168\u306a\u518d\u540c\u671f\u304c\u5fc5\u8981\u3067\u3059\u3002\u7406\u7531: \u63d0\u4f9b\u3055\u308c\u305f Cookie \u306f\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30c8\u3055\u308c\u305f\u30c9\u30e1\u30a4\u30f3\u306e\u30b5\u30fc\u30d0\u30fc\u3067\u306e\u5c65\u6b74\u958b\u59cb\u3088\u308a\u3082\u53e4\u3044\u3067\u3059: %s
-SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=\u63d0\u4f9b\u3055\u308c\u305f Cookie \u306e\u7121\u52b9\u306a\u69cb\u6587
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=\u30c9\u30e1\u30a4\u30f3 %s (\u30b5\u30fc\u30d0\u30fc ID: %s): \u521d\u671f\u5316\u4e2d\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u5074\u306e\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u306e\u63a5\u7d9a\u89e3\u9664 (\u30b5\u30fc\u30d0\u30fc ID: %s) \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f
SEVERE_ERR_INIT_IMPORT_FAILURE_190=\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u306e\u521d\u671f\u5316\u4e2d\u306b\u6b21\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: %s
SEVERE_ERR_INIT_RS_DISCONNECTION_DURING_IMPORT_191=\u30a4\u30f3\u30dd\u30fc\u30c8\u4e2d\u306b\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc %s \u3068\u306e\u63a5\u7d9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f
diff --git a/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties b/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties
index 174b4af..eb29d4d 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties
@@ -179,7 +179,6 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=\u542f\u7528\u5916\u90e8\u66f4\u6539\u65e5\u5fd7\u65f6\u5728 %s \u4e2d\u51fa\u73b0\u9519\u8bef: %s
SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=\u8981\u6c42\u5b8c\u5168\u518d\u540c\u6b65\u3002\u539f\u56e0\uff1a\u63d0\u4f9b\u7684 cookie \u5305\u542b\u672a\u77e5\u7684\u590d\u5236\u57df %s\u3002Cookie <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=\u8981\u6c42\u5b8c\u5168\u518d\u540c\u6b65\u3002\u539f\u56e0\uff1a\u63d0\u4f9b\u7684 cookie \u65e9\u4e8e\u590d\u5236\u57df %s \u7684\u670d\u52a1\u5668\u4e2d\u7684\u5386\u53f2\u8d77\u70b9
-SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=\u63d0\u4f9b cookie \u7684\u8bed\u6cd5\u65e0\u6548
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=\u57df %s\uff08\u670d\u52a1\u5668 ID: %s\uff09\uff1a\u5728\u521d\u59cb\u5316\u671f\u95f4\u68c0\u6d4b\u5230\u8fdc\u7a0b\u5bfc\u51fa\u7a0b\u5e8f\u670d\u52a1\u5668\u65ad\u5f00\u8fde\u63a5\uff08\u670d\u52a1\u5668 ID: %s\uff09
SEVERE_ERR_INIT_IMPORT_FAILURE_190=\u5728\u4ece\u8fdc\u7a0b\u670d\u52a1\u5668\u8fdb\u884c\u521d\u59cb\u5316\u671f\u95f4\uff0c\u53d1\u751f\u4ee5\u4e0b\u9519\u8bef: %s
SEVERE_ERR_INIT_RS_DISCONNECTION_DURING_IMPORT_191=\u5728\u5bfc\u5165\u671f\u95f4\u4e0e\u590d\u5236\u670d\u52a1\u5668 %s \u8fde\u63a5\u5931\u8d25
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java b/opendj-sdk/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
index 5085649..7e2cea2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
@@ -174,9 +174,7 @@
return list.isEmpty();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public Iterator<DN> iterator()
{
@@ -214,43 +212,45 @@
/**
* Splits the provided generalizedServerState being a String with the
- * following syntax: "domain1:state1;domain2:state2;..."
- * to a TreeMap of (domain DN, domain ServerState).
- * @param multidomainserverstate the provided state
- * @exception DirectoryException when an error occurs
+ * following syntax: "domain1:state1;domain2:state2;..." to a Map of (domain
+ * DN, domain ServerState).
+ *
+ * @param multiDomainServerState
+ * the provided multi domain server state also known as cookie
+ * @exception DirectoryException
+ * when an error occurs
* @return the split state.
*/
public static Map<DN, ServerState> splitGenStateToServerStates(
- String multidomainserverstate) throws DirectoryException
+ String multiDomainServerState) throws DirectoryException
{
Map<DN, ServerState> startStates = new TreeMap<DN, ServerState>();
- if (multidomainserverstate != null && multidomainserverstate.length() > 0)
+ if (multiDomainServerState != null && multiDomainServerState.length() > 0)
{
try
{
- // Split the provided multidomainserverstate into domains
- String[] domains = multidomainserverstate.split(";");
+ // Split the provided multiDomainServerState into domains
+ String[] domains = multiDomainServerState.split(";");
for (String domain : domains)
{
// For each domain, split the CSNs by server
// and build a server state (SHOULD BE OPTIMIZED)
- ServerState serverStateByDomain = new ServerState();
+ final ServerState serverStateByDomain = new ServerState();
- String[] fields = domain.split(":");
+ final String[] fields = domain.split(":");
if (fields.length == 0)
{
throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
- ERR_INVALID_COOKIE_SYNTAX.get());
+ ERR_INVALID_COOKIE_SYNTAX.get(multiDomainServerState));
}
- String domainBaseDN = fields[0];
+ final String domainBaseDN = fields[0];
if (fields.length > 1)
{
- String strState = fields[1];
- String[] strCSN = strState.split(" ");
- for (String sr : strCSN)
+ final String serverStateStr = fields[1];
+ for (String csnStr : serverStateStr.split(" "))
{
- CSN fromCSN = new CSN(sr);
- serverStateByDomain.update(fromCSN);
+ final CSN csn = new CSN(csnStr);
+ serverStateByDomain.update(csn);
}
}
startStates.put(DN.decode(domainBaseDN), serverStateByDomain);
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
index 38218af..cb098a4 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
@@ -34,6 +34,7 @@
import java.net.Socket;
import java.util.*;
+import org.assertj.core.api.Assertions;
import org.opends.server.TestCaseUtils;
import org.opends.server.admin.std.server.ExternalChangelogDomainCfg;
import org.opends.server.api.Backend;
@@ -793,9 +794,8 @@
searchOp = searchOnCookieChangelog("(targetDN=*" + tn + "*,o=test)", cookie, tn,
PROTOCOL_ERROR);
assertEquals(searchOp.getSearchEntries().size(), 0);
- assertTrue(searchOp.getErrorMessage().toString().equals(
- ERR_INVALID_COOKIE_SYNTAX.get().toString()),
- searchOp.getErrorMessage().toString());
+ Assertions.assertThat(searchOp.getErrorMessage().toString()).startsWith(
+ ERR_INVALID_COOKIE_SYNTAX.get(cookie).toString());
// Test unknown domain in provided cookie
// This case seems to be very hard to obtain in the real life
--
Gitblit v1.10.0