From 759266775eddcebcf4e7355383169b7ad4bafa2d Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Thu, 04 Oct 2012 15:43:07 +0000
Subject: [PATCH] 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
---
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java | 8 +++-----
opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java | 24 ++++++++++++++++++------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java b/opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
index 6fc4e5c..5155d48 100644
--- a/opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
+++ b/opendj-sdk/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();
}
/**
diff --git a/opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java b/opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
index a06347f..4720db2 100644
--- a/opendj-sdk/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java
+++ b/opendj-sdk/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
-
}
/**
--
Gitblit v1.10.0