From 9defd2349274d077ad120d780a6fac5f6d594c7f Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 22 May 2015 15:58:46 +0000
Subject: [PATCH] OPENDJ-1631 CR-6864 Migrate server to SDK syntaxes

---
 opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java
index 71257d7..66c3988 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java
@@ -22,18 +22,24 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
- *      Portions Copyright 2012-2014 ForgeRock AS
+ *      Portions Copyright 2012-2015 ForgeRock AS
  */
 package org.opends.server.schema;
 
 import static org.testng.Assert.*;
 
-import org.opends.server.api.AttributeSyntax;
-import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.SchemaBuilder;
+import org.forgerock.opendj.ldap.schema.SchemaOptions;
+import org.forgerock.opendj.ldap.schema.Syntax;
+import org.opends.server.api.AttributeSyntax;
+import org.opends.server.util.RemoveOnceSDKSchemaIsUsed;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+@RemoveOnceSDKSchemaIsUsed
 public abstract class AttributeSyntaxTest extends SchemaTestCase
 {
   /**
@@ -52,7 +58,7 @@
    *
    * @return An instance of the attribute syntax that must be tested.
    */
-  protected abstract AttributeSyntax getRule();
+  protected abstract AttributeSyntax<?> getRule();
 
   /**
    * Test the normalization and the approximate comparison.
@@ -62,7 +68,11 @@
          throws Exception
   {
     // Make sure that the specified class can be instantiated as a task.
-    AttributeSyntax syntax = getRule();
+
+    SchemaBuilder schemaBuilder = new SchemaBuilder(Schema.getCoreSchema());
+    schemaBuilder.setOption(SchemaOptions.STRICT_FORMAT_FOR_COUNTRY_STRINGS, true);
+    Schema schema = schemaBuilder.toSchema();
+    Syntax syntax = getRule().getSDKSyntax(schema);
 
     LocalizableMessageBuilder reason = new LocalizableMessageBuilder();
     // test the valueIsAcceptable method
@@ -73,14 +83,5 @@
       fail(syntax + ".valueIsAcceptable gave bad result for " + value +
           "reason : " + reason);
 
-    // call the getters
-    syntax.getApproximateMatchingRule();
-    syntax.getDescription();
-    syntax.getEqualityMatchingRule();
-    syntax.getOID();
-    syntax.getOrderingMatchingRule();
-    syntax.getSubstringMatchingRule();
-    syntax.getName();
-    syntax.toString();
   }
 }

--
Gitblit v1.10.0