From 702b6351ed3207102d0bf4a152f45cf74452eeb3 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 12 Dec 2011 17:33:59 +0000
Subject: [PATCH] Additional fixes for OPENDJ-381: Implement LDIF diff, patch, and search API support in the SDK
---
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java | 44 +++++++++++++++++++++++++++++++-------------
1 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
index f589f31..27a5e6d 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
+ * Portions copyright 2011 ForgeRock AS.
*/
package org.forgerock.opendj.ldap;
@@ -149,6 +150,7 @@
@DataProvider(name = "createRDNEqualityData")
public Object[][] createRDNEqualityData()
{
+ // @formatter:off
return new Object[][] {
{ "cn=hello world", "cn=hello world", 0 },
{ "cn=hello world", "CN=hello world", 0 },
@@ -168,10 +170,19 @@
// { "x-test-integer-type=999", "x-test-integer-type=1000", -1 },
// { "x-test-integer-type=-1", "x-test-integer-type=0", -1 },
// { "x-test-integer-type=0", "x-test-integer-type=-1", 1 },
- { "cn=aaa", "cn=aaaa", -1 }, { "cn=AAA", "cn=aaaa", -1 },
- { "cn=aaa", "cn=AAAA", -1 }, { "cn=aaaa", "cn=aaa", 1 },
- { "cn=AAAA", "cn=aaa", 1 }, { "cn=aaaa", "cn=AAA", 1 },
- { "cn=aaab", "cn=aaaa", 1 }, { "cn=aaaa", "cn=aaab", -1 } };
+ { "cn=aaa", "cn=aaaa", -1 },
+ { "cn=AAA", "cn=aaaa", -1 },
+ { "cn=aaa", "cn=AAAA", -1 },
+ { "cn=aaaa", "cn=aaa", 1 },
+ { "cn=AAAA", "cn=aaa", 1 },
+ { "cn=aaaa", "cn=AAA", 1 },
+ { "cn=aaab", "cn=aaaa", 1 },
+ { "cn=aaaa", "cn=aaab", -1 },
+ { RDN.maxValue(), RDN.maxValue(), 0 },
+ { RDN.maxValue(), "cn=aaa", 1 },
+ { "cn=aaa", RDN.maxValue(), -1 },
+ };
+ // @formatter:on
}
@@ -206,11 +217,11 @@
* If the test failed unexpectedly.
*/
@Test(dataProvider = "createRDNEqualityData")
- public void testCompareTo(final String first, final String second,
+ public void testCompareTo(final Object first, final Object second,
final int result) throws Exception
{
- final RDN rdn1 = RDN.valueOf(first);
- final RDN rdn2 = RDN.valueOf(second);
+ final RDN rdn1 = parseRDN(first);
+ final RDN rdn2 = parseRDN(second);
int rc = rdn1.compareTo(rdn2);
@@ -230,6 +241,13 @@
+ private RDN parseRDN(final Object value)
+ {
+ return (value instanceof RDN) ? ((RDN) value) : RDN.valueOf(value.toString());
+ }
+
+
+
/**
* Test RDN construction with single AVA.
*
@@ -362,11 +380,11 @@
* If the test failed unexpectedly.
*/
@Test(dataProvider = "createRDNEqualityData")
- public void testEquality(final String first, final String second,
+ public void testEquality(final Object first, final Object second,
final int result) throws Exception
{
- final RDN rdn1 = RDN.valueOf(first);
- final RDN rdn2 = RDN.valueOf(second);
+ final RDN rdn1 = parseRDN(first);
+ final RDN rdn2 = parseRDN(second);
if (result == 0)
{
@@ -448,11 +466,11 @@
* If the test failed unexpectedly.
*/
@Test(dataProvider = "createRDNEqualityData")
- public void testHashCode(final String first, final String second,
+ public void testHashCode(final Object first, final Object second,
final int result) throws Exception
{
- final RDN rdn1 = RDN.valueOf(first);
- final RDN rdn2 = RDN.valueOf(second);
+ final RDN rdn1 = parseRDN(first);
+ final RDN rdn2 = parseRDN(second);
final int h1 = rdn1.hashCode();
final int h2 = rdn2.hashCode();
--
Gitblit v1.10.0