From 5d6e9428fedead57a9c9438cebe58b485ff476d2 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 14 Sep 2007 10:22:17 +0000
Subject: [PATCH] Avoid managed object definition initialization dependency problems. Using features like inherited default values and aggregation properties it is quite straightforward to encounter initialization dependency problems. For example: the global configuration will contain an aggregation property which references the default password policy. This aggregation definition is defined using a managed object path which, when decoded, contains a reference to the root configuration and its "password-policy" relation. This is what happens during initialization of the root configuration:
---
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestCfg.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestCfg.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestCfg.java
index 82c1a1a..4d4d0cb 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestCfg.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/TestCfg.java
@@ -127,6 +127,7 @@
// Register the test parent resource bundle.
TestParentCfgDefn d = TestParentCfgDefn.getInstance();
+ d.initialize();
String baseName = d.getClass().getName();
ResourceBundle resourceBundle = ResourceBundle.getBundle(baseName);
ManagedObjectDefinitionI18NResource.getInstance().setResourceBundle(d,
@@ -139,6 +140,7 @@
// Register the test child resource bundle.
TestChildCfgDefn d = TestChildCfgDefn.getInstance();
+ d.initialize();
String baseName = d.getClass().getName();
ResourceBundle resourceBundle = ResourceBundle.getBundle(baseName);
ManagedObjectDefinitionI18NResource.getInstance().setResourceBundle(d,
@@ -216,6 +218,22 @@
/**
+ * Initializes a property definition and its default behavior.
+ *
+ * @param pd
+ * The property definition to be initialized.
+ * @throws Exception
+ * If the property definition could not be initialized.
+ */
+ public static void initializePropertyDefinition(PropertyDefinition<?> pd)
+ throws Exception {
+ pd.initialize();
+ pd.getDefaultBehaviorProvider().initialize();
+ }
+
+
+
+ /**
* Adds a constraint temporarily with test child definition.
*
* @param constraint
--
Gitblit v1.10.0