From 86b9cc7dc474e75940d538ecf1e252ef191bc111 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 07 Mar 2016 15:10:53 +0000
Subject: [PATCH] OPENDJ-1342 Migrate AVA, RDN, and DN classes: Fix change in behaviour for DN.toString()
---
opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java | 2 +-
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java | 6 +++---
opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java | 6 +++---
opendj-server-legacy/src/test/java/org/opends/server/types/TestSubtreeSpecification.java | 19 ++++++++-----------
4 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java
index d48cad3..43eab1b 100644
--- a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java
@@ -408,7 +408,7 @@
// No differences expected.
assertThat(Entries.diffEntries(original, expectedEntry).getModifications()).isEmpty();
- assertThat(srEntry.getName().toString()).isEqualTo("uid=user.1,o=test");
+ assertThat((Object) srEntry.getName()).isEqualTo(DN.valueOf("uid=user.1,o=test"));
assertThat(srEntry.getAttributeCount()).isEqualTo(7);
assertThat(srEntry.getAttribute("description").firstValueAsString()).isEqualTo(
"This is the description for Aaren Atp.");
@@ -552,7 +552,7 @@
connection.searchSingleEntry(Requests.newSearchRequest(
"uid=user.1, o=test", SearchScope.BASE_OBJECT, "(uid=user.1)"));
assertThat(srEntry).isNotNull();
- assertThat(srEntry.getName().toString()).isEqualTo("uid=user.1,o=test");
+ assertThat((Object) srEntry.getName()).isEqualTo(DN.valueOf("uid=user.1,o=test"));
connection.close();
}
@@ -863,7 +863,7 @@
assertThat(reader.isEntry()).isTrue();
final SearchResultEntry entry = reader.readEntry();
assertThat(entry).isNotNull();
- assertThat(entry.getName().toString()).isEqualTo("uid=user.1,o=test");
+ assertThat((Object) entry.getName()).isEqualTo(DN.valueOf("uid=user.1,o=test"));
assertThat(reader.hasNext()).isFalse();
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java
index 85875d6..ffbea0e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java
@@ -301,7 +301,7 @@
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
c.addExpectedAttribute("ds-cfg-attribute-type", "description");
c.addExpectedAttribute("ds-cfg-rotation-policy",
- "cn=LDAP Connection Handler,cn=connection handlers,cn=config");
+ "cn=LDAP Connection Handler,cn=connection handlers, cn=config");
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = getTestParent(ctx, "test parent 1");
@@ -329,8 +329,8 @@
"cn=test child 2,cn=test children,cn=test parent 1,cn=test parents,cn=config");
c.importLDIF(TEST_LDIF);
c.addExpectedModification("ds-cfg-rotation-policy",
- "cn=LDAPS Connection Handler,cn=connection handlers,cn=config",
- "cn=JMX Connection Handler,cn=connection handlers,cn=config");
+ "cn=LDAPS Connection Handler,cn=connection handlers, cn=config",
+ "cn=JMX Connection Handler,cn=connection handlers, cn=config");
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = getTestParent(ctx, "test parent 1");
TestChildCfgClient child = parent.getTestChild("test child 2");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
index 0527c23..b8d5cc9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
@@ -248,7 +248,7 @@
@Test(dataProvider = "testDNs")
public void testToString(String rawDN, String unused, String stringDN) throws Exception {
DN dn = DN.valueOf(rawDN);
- assertEquals(dn.toString(), stringDN);
+ assertEquals(dn.toString(), rawDN);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestSubtreeSpecification.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestSubtreeSpecification.java
index a4f9640..8d5a0aa 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestSubtreeSpecification.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestSubtreeSpecification.java
@@ -27,24 +27,21 @@
@SuppressWarnings("javadoc")
public final class TestSubtreeSpecification extends SubtreeSpecificationTestCase {
- /** Cached root DN. */
- private DN rootDN = DN.rootDN();
-
@DataProvider
public Object[][] valueOfData() {
return new Object[][] {
{ "{}", "{ }" },
{ " { } ", "{ }" },
{ "{ base \"dc=sun, dc=com\" }",
- "{ base \"dc=sun,dc=com\" }" },
+ "{ base \"dc=sun, dc=com\" }" },
{ "{base \"dc=sun, dc=com\"}",
- "{ base \"dc=sun,dc=com\" }" },
- { "{ base \"dc=sun, dc=com\", " + "specificationFilter item:ds-config-rootDN }",
- "{ base \"dc=sun,dc=com\", " + "specificationFilter item:ds-config-rootDN }" },
+ "{ base \"dc=sun, dc=com\" }" },
+ { "{ base \"dc=sun, dc=com\", specificationFilter item:ds-config-rootDN }",
+ "{ base \"dc=sun, dc=com\", specificationFilter item:ds-config-rootDN }" },
{ "{ base \"dc=sun, dc=com\", minimum 0 , maximum 10, "
+ "specificExclusions {chopBefore:\"o=abc\", "
+ "chopAfter:\"o=xyz\"} , specificationFilter not:not:item:foo }",
- "{ base \"dc=sun,dc=com\", "
+ "{ base \"dc=sun, dc=com\", "
+ "specificExclusions { chopBefore:\"o=abc\", "
+ "chopAfter:\"o=xyz\" }, maximum 10, specificationFilter "
+ "not:not:item:foo }" },
@@ -61,13 +58,13 @@
{ "{ specificationFilter or:{item:top, item:foo, and:{item:one, item:two}} }",
"{ specificationFilter or:{item:top, item:foo, and:{item:one, item:two}} }" },
{ "{ base \"dc=sun, dc=com\", specificationFilter \"(objectClass=*)\" }",
- "{ base \"dc=sun,dc=com\", specificationFilter \"(objectClass=*)\" }" },
+ "{ base \"dc=sun, dc=com\", specificationFilter \"(objectClass=*)\" }" },
};
}
@Test(dataProvider = "valueOfData")
public void testValueOf(String specification, String expected) throws Exception {
- SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, specification);
+ SubtreeSpecification ss = SubtreeSpecification.valueOf(DN.rootDN(), specification);
assertEquals(ss.toString(), expected);
}
@@ -117,7 +114,7 @@
@Test(dataProvider = "isWithinScopeData")
public void testIsWithinScope(String dnString, String value, boolean expected) throws Exception {
DN dn = DN.valueOf(dnString);
- SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, value);
+ SubtreeSpecification ss = SubtreeSpecification.valueOf(DN.rootDN(), value);
assertEquals(ss.isWithinScope(createEntry(dn, getObjectClasses())), expected);
}
}
--
Gitblit v1.10.0