mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
01.02.2012 40980452c3a72e4944306da2d6e25691d824cde8
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
@@ -62,7 +62,7 @@
        entry.addAttribute("givenName", "John");
        entry.addAttribute("description", "one two", "three four",
                "This is a very very long description, Neque porro quisquam est qui dolorem ipsum"
                        + "quia dolor sit amet, consectetur, adipisci velit...");
                + "quia dolor sit amet, consectetur, adipisci velit...");
        entry.addAttribute("typeOnly");
        entry.addAttribute("mail", "email@example.com");
        entry.addAttribute("localized;lang-fr", "\u00e7edilla");
@@ -75,7 +75,8 @@
     * Test setExcludeAttribute method of LDIFEntryWriter Throws a
     * NullPointerException if the attributeDescription is null.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testSetExcludeAttributeDoesntAllowNull() throws Exception {
@@ -90,7 +91,8 @@
    /**
     * Test to write an entry with attribute exclusions.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeAttributeWithMatch() throws Exception {
@@ -114,7 +116,8 @@
     * Test to write an entry with attribute exclusions. In this test, the
     * attribute description 'vip' doesn't exist then the entry must be written
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeAttributeWithNoMatch() throws Exception {
@@ -139,7 +142,8 @@
     * Test SetExcludeBranch method of LDIFEntryWriter Throws a
     * NullPointerException if the excludeBranch is null.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testSetExcludeBranchDoesntAllowNull() throws Exception {
@@ -154,7 +158,8 @@
    /**
     * Test SetExcludeBranch method of LDIFEntryWriter.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeBranchWrongDN() throws Exception {
@@ -176,7 +181,8 @@
    /**
     * Test SetExcludeBranch method of LDIFEntryWriter.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeBranchWithNoMatch() throws Exception {
@@ -197,7 +203,8 @@
    /**
     * Test SetExcludeBranch method of LDIFEntryWriter.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeBranchWithMatch() throws Exception {
@@ -219,7 +226,8 @@
     * Test SetExcludeFilter method of LDIFEntryWriter Throws a
     * NullPointerException if the excludeFilter is null.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testsetExcludeFilterDoesntAllowNull() throws Exception {
@@ -235,7 +243,8 @@
     * Test testSetExcludeFilter method of LDIFEntryWriter. StandardEntry has an
     * objectclass : person
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeFilterWithMatch() throws Exception {
@@ -258,7 +267,8 @@
     * Test testSetExcludeFilter method of LDIFEntryWriter StandardEntry has an
     * objectclass : person
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeFilterWithNoMatch() throws Exception {
@@ -280,7 +290,8 @@
     * Test SetIncludeAttribute method of LDIFEntryWriter Throws a
     * NullPointerException if the attributeDescription is null.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testSetIncludeAttributeDoesntAllowNull() throws Exception {
@@ -294,7 +305,8 @@
     * Test SetIncludeAttribute method of LDIFEntryWriter. Inserting attribute
     * cn (common name) & sn (surname)
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeAttributeWithMatch() throws Exception {
@@ -315,7 +327,8 @@
     * field "manager" is not present in the StandardEntry. Then the entry must
     * only write the first line : dn: cn=John Doe,ou=people,dc=example,dc=com
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeAttributeWithNoMatch() throws Exception {
@@ -337,7 +350,8 @@
     * Test SetIncludeAttribute method of LDIFEntryWriter. Attempted insertions
     * repeating attributes. An attribute mustn't be written twice or +.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeAttributeWithRepeatedAttributes() throws Exception {
@@ -362,7 +376,8 @@
     * Test to write an entry excluding all operational attributes
     * setExcludeAllOperationalAttributes to false (default case)
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeAllOperationalAttributesFalse() throws Exception {
@@ -392,7 +407,8 @@
     * setExcludeAllOperationalAttributes is forced to true Result should be dn:
     * cn=John Doe,ou=people,dc=example,dc=com plus an empty line.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeAllOperationalAttributesTrue() throws Exception {
@@ -415,9 +431,10 @@
    /**
     * Test to write an entry excluding user attributes Default case - full
     * entry must be written
     * entry must be written.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeAllUserAttributesFalse() throws Exception {
@@ -438,7 +455,8 @@
     * Test to write an entry excluding user attributes result should be dn:
     * cn=John Doe,ou=people,dc=example,dc=com plus an empty line.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetExcludeAllUserAttributesTrue() throws Exception {
@@ -463,7 +481,8 @@
     * Test SetIncludeBranch method of LDIFEntryWriter Throws a
     * NullPointerException if the includeBranch is null.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testSetIncludeBranchDoesntAllowNull() throws Exception {
@@ -477,7 +496,8 @@
     * Test SetIncludeBranch method of LDIFEntryWriter verifying right data are
     * present.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeBranchWithMatch() throws Exception {
@@ -498,9 +518,10 @@
    /**
     * Test SetIncludeBranch method of LDIFEntryWriter DN included is
     * "dc=opendj,dc=org", which is not the one from the standard entry Entry
     * must not be written
     * must not be written.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeBranchWithNoMatch() throws Exception {
@@ -522,7 +543,8 @@
     * Filter.equality("objectclass", "vip"); which is not the one from the
     * standard entry.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeFilterWithNoMatch() throws Exception {
@@ -544,7 +566,8 @@
     * Filter.equality("objectclass", "person"); which is the one from the
     * standard entry.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetIncludeFilterWithMatch() throws Exception {
@@ -567,7 +590,8 @@
     * Test SetIncludeFilter method of LDIFEntryWriter Throws a
     * NullPointerException if the schema is null.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testSetIncludeFilterDoesntAllowNull() throws Exception {
@@ -687,7 +711,8 @@
    /**
     * Test to write an entry adding the user friendly Comment TODO
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testSetAddUserFriendlyComments() throws Exception {
@@ -775,7 +800,8 @@
     * Testing the WriteEntry function using the mock for testing more
     * IOExceptions and verify if they are correctly handled.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test(expectedExceptions = IOException.class)
    public void testWriteEntryUsingMockOutputThrowsIOException() throws Exception {
@@ -796,7 +822,8 @@
    /**
     * Verify flush/close are also forwarded to the stream.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testWriteEntryUsingMockOutputForFlushAndClose() throws Exception {
@@ -816,7 +843,8 @@
     * Test the WriteEntry using an output file verifying write is correctly
     * invoked.
     *
     * @throws Exception If the test failed unexpectedly.
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    public void testWriteEntryOutputStreamUsingMock() throws Exception {