| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "testDNs") |
| | | @Test(enabled = false, dataProvider = "testDNs") |
| | | public void testValueOf(String rawDN, String normDN, String unused) throws Exception { |
| | | DN dn = DN.valueOf(rawDN); |
| | | assertEquals(dn.toNormalizedUrlSafeString(), normDN); |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "testDNs") |
| | | @Test(enabled = false, dataProvider = "testDNs") |
| | | public void testValueOfByteString(String rawDN, String normDN, String unused) throws Exception { |
| | | DN dn = DN.valueOf(ByteString.valueOfUtf8(rawDN)); |
| | | assertEquals(dn.toNormalizedUrlSafeString(), normDN); |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "testDNs") |
| | | @Test(enabled = false, dataProvider = "testDNs") |
| | | public void testToString(String rawDN, String unused, String stringDN) throws Exception { |
| | | DN dn = DN.valueOf(rawDN); |
| | | assertEquals(dn.toString(), rawDN); |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test |
| | | public void testValueOfNull() throws Exception { |
| | | @Test(enabled = false) |
| | | public void testValueOfNull() throws Exception |
| | | { |
| | | assertEquals(DN.valueOf((ByteString) null), DN.rootDN()); |
| | | assertEquals(DN.valueOf((String) null), DN.rootDN()); |
| | | } |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | @Test(enabled = false, dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testIllegalStringDNs(String dn) throws Exception { |
| | | DN.valueOf(dn); |
| | | } |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | @Test(enabled = false, dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testIllegalOctetStringDNs(String dn) throws Exception { |
| | | ByteString octetString = ByteString.valueOfUtf8(dn); |
| | | DN.valueOf(octetString); |
| | |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "createParentAndRDNTestData") |
| | | public void testGetRDN(String s, String p, String r) |
| | | public void testRDN(String s, String p, String r) |
| | | throws Exception { |
| | | DN dn = DN.valueOf(s); |
| | | RDN rdn = r != null ? RDN.valueOf(r) : null; |
| | |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "createRDNTestData") |
| | | public void testGetRDNIndexed(String s, int i, String r) |
| | | public void testRDNIndexed(String s, int i, String r) |
| | | throws Exception { |
| | | DN dn = DN.valueOf(s); |
| | | RDN rdn = RDN.valueOf(r); |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "createRDNIllegalTestData", expectedExceptions = IndexOutOfBoundsException.class) |
| | | public void testGetRDNIndexedException(String s, int i) |
| | | throws Exception { |
| | | @Test(enabled = false, dataProvider = "createRDNIllegalTestData") |
| | | public void testRDNIndexedException(String s, int i) throws Exception |
| | | { |
| | | DN dn = DN.valueOf(s); |
| | | |
| | | // Shoudld throw. |
| | | dn.rdn(i); |
| | | |
| | | Assert.fail("Excepted exception for RDN index " + i + " in DN " + s); |
| | | assertNull(dn.rdn(i)); |
| | | } |
| | | |
| | | |