From 63221c7642b83249c5492ee89af5c334418ab38f Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 20 Sep 2007 12:07:10 +0000
Subject: [PATCH] Make sure that constraints are enforced when decoding managed objects in unit tests.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java
index b65ad39..cd7095f 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java
@@ -88,6 +88,10 @@
       ServerManagementContext context = ServerManagementContext.getInstance();
       ServerManagedObject<? extends S> mo = context.decode(getPath(definition),
           configEntry);
+      
+      // Ensure constraints are satisfied.
+      mo.ensureIsUsable();
+      
       return mo.getConfiguration();
     } catch (DefinitionDecodingException e) {
       throw ConfigExceptionFactory.getInstance()
@@ -95,6 +99,9 @@
     } catch (ServerManagedObjectDecodingException e) {
       throw ConfigExceptionFactory.getInstance()
           .createDecodingExceptionAdaptor(e);
+    } catch (ConstraintViolationException e) {
+      throw ConfigExceptionFactory.getInstance()
+      .createDecodingExceptionAdaptor(e);
     }
   }
 

--
Gitblit v1.10.0