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

Violette Roche-Montane
04.43.2012 363b7d80aad7e46257e6aeafa688adfe7c7d6c94
General :
- add @SuppressWarnings("javadoc")
- use file:/xxx URL instead since these do not depend on external factors. (fixed)
- add reader.close() to LDIFEntryReaderTestCase for suppress warnings

CR-715
- mark tests as disabled for friendlyComment.
- fix InvalidProtocol in the LDIFEntryReader > testValueOfLDIFEntryReadEntryContainingMalformedURL().
2 files modified
32 ■■■■■ changed files
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java 24 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java 8 ●●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
@@ -29,6 +29,7 @@
import static org.testng.Assert.assertNotNull;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -156,6 +157,7 @@
    public void testSetExcludeBranchDoesntAllowNull() throws Exception {
        final LDIFEntryReader reader = new LDIFEntryReader(getStandardEntry());
        reader.setExcludeBranch(null);
        reader.close();
    }
    /**
@@ -263,6 +265,7 @@
        final LDIFEntryReader reader = new LDIFEntryReader(getStandardEntry());
        reader.setExcludeAttribute(null);
        reader.close();
    }
    /**
@@ -477,6 +480,7 @@
    public void testSetIncludeBranchDoesntAllowNull() throws Exception {
        final LDIFEntryReader reader = new LDIFEntryReader(getStandardEntry());
        reader.setIncludeBranch(null);
        reader.close();
    }
    /**
@@ -536,6 +540,7 @@
    public void testSetIncludeFilterDoesntAllowNull() throws Exception {
        final LDIFEntryReader reader = new LDIFEntryReader(getStandardEntry());
        reader.setIncludeFilter(null);
        reader.close();
    }
    /**
@@ -782,7 +787,7 @@
        final LDIFEntryReader reader = new LDIFEntryReader(strEntry);
        reader.setSchema(Schema.getDefaultSchema());
        reader.setSchemaValidationPolicy(null);
        reader.close();
    }
    /**
@@ -888,6 +893,7 @@
        final LDIFEntryReader reader = new LDIFEntryReader(getStandardEntry());
        reader.setSchema(null); // must throw a NullPointerException
        reader.close();
    }
    /**
@@ -1256,6 +1262,10 @@
     */
    @Test()
    public void testValueOfLDIFEntryReadEntryContainingURL() throws Exception {
        final File file = File.createTempFile("sdk", ".jpeg");
        final String url = file.toURI().toURL().toString();
        // @formatter:off
        final LDIFEntryReader reader = new LDIFEntryReader(
                "#A single comment",
@@ -1271,7 +1281,7 @@
                "sn: Jensen",
                "uid: hjensen",
                "telephonenumber: +1 408 555 1212",
                "jpegphoto:< http://www.forgerock.com/sites/default/files/forgerock_logo.png",
                "jpegphoto:< " + url,
                "#This is a end line comment", "# Followed by another"
        );
        // @formatter:on
@@ -1283,18 +1293,19 @@
            assertThat(entry.getAttribute("jpegphoto")).isNotEmpty();
            assertThat(entry.getAttribute("cn").firstValueAsString()).isEqualTo("Horatio Jensen");
        } finally {
            file.delete();
            reader.close();
        }
    }
    /**
     * LDIFEntryReader entry containing a reference to an external file & an
     * invalid protocol.
     * LDIFEntryReader entry containing a malformed URL.
     *
     * @throws Exception
     */
    // TODO
    @Test(expectedExceptions = DecodeException.class)
    public void testValueOfLDIFEntryReadEntryContainingURLInvalidProtocol() throws Exception {
    public void testValueOfLDIFEntryReadEntryContainingMalformedURL() throws Exception {
        // @formatter:off
        final LDIFEntryReader reader = new LDIFEntryReader(
@@ -1515,7 +1526,8 @@
     */
    @Test(expectedExceptions = NullPointerException.class)
    public void testLDIFEntryReaderInpuStreamDoesntAllowNull() throws Exception {
        new LDIFEntryReader((InputStream) null);
        final LDIFEntryReader reader = new LDIFEntryReader((InputStream) null);
        reader.close();
    }
    /**
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
@@ -46,6 +46,7 @@
/**
 * This class tests the LDIFEntryWriter functionality.
 */
@SuppressWarnings("javadoc")
public final class LDIFEntryWriterTestCase extends LDIFTestCase {
    /**
@@ -709,12 +710,12 @@
    }
    /**
     * Test to write an entry adding the user friendly Comment TODO
     * Test to write an entry adding the user friendly Comment.
     *
     * @throws Exception
     *             If the test failed unexpectedly.
     */
    @Test
    @Test(enabled = false)
    public void testSetAddUserFriendlyComments() throws Exception {
        final List<String> actual = new ArrayList<String>();
        final LDIFEntryWriter writer = new LDIFEntryWriter(actual);
@@ -724,9 +725,6 @@
        writer.setAddUserFriendlyComments(true);
        writer.writeComment0(comment);
        writer.close();
        // TODO Add a test when the function will be implemented in AbstractLDIFWriter
    }
    /**