summaryrefslogtreecommitdiff
path: root/src/connectors/JUTests/data/io/ldap
diff options
context:
space:
mode:
Diffstat (limited to 'src/connectors/JUTests/data/io/ldap')
-rw-r--r--src/connectors/JUTests/data/io/ldap/LDAPDataReaderTest.java94
-rw-r--r--src/connectors/JUTests/data/io/ldap/LDAPDataWriterTest.java16
2 files changed, 110 insertions, 0 deletions
diff --git a/src/connectors/JUTests/data/io/ldap/LDAPDataReaderTest.java b/src/connectors/JUTests/data/io/ldap/LDAPDataReaderTest.java
new file mode 100644
index 0000000..dcfc602
--- /dev/null
+++ b/src/connectors/JUTests/data/io/ldap/LDAPDataReaderTest.java
@@ -0,0 +1,94 @@
+package data.io.ldap;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import data.MVDataEntry;
+
+public class LDAPDataReaderTest {
+
+ LDAPConnectionWrapper builder;
+
+ @Before
+ public void setup() {
+ builder = new LDAPConnectionWrapper("localhost", 389, "uid=ldapadmin,ou=specialUsers,dc=univ-jfc,dc=fr", "secret");
+ }
+
+ /*
+ @Test
+ public void testLookAhead1() {
+ _testLookAhead(1);
+ }
+ */
+
+ @Test
+ public void testLookAhead16() {
+ _testLookAhead(16);
+ }
+
+ @Test
+ public void testLookAhead32() {
+ _testLookAhead(32);
+ }
+
+ @Test
+ public void testLookAhead64() {
+ _testLookAhead(64);
+ }
+
+ @Test
+ public void testLookAhead128() {
+ _testLookAhead(128);
+ }
+
+ @Test
+ public void testLookAhead192() {
+ _testLookAhead(192);
+ }
+
+ @Test
+ public void testLookAhead256() {
+ _testLookAhead(256);
+ }
+
+ @Test
+ public void testLookAhead512() {
+ _testLookAhead(512);
+ }
+
+ @Test
+ public void testLookAhead1024() {
+ _testLookAhead(1024);
+ }
+
+ private void _testLookAhead(int lookAheadAmount) {
+ System.out.println("_testLookAhead("+lookAheadAmount+")");
+ LDAPFlatDataReader reader = builder.newFlatReader("ldap_test", "ou=people,dc=univ-jfc,dc=fr", "uid", lookAheadAmount);
+
+ int resultCount = 0;
+ String previousKey=null;
+ for ( MVDataEntry entry : reader ) {
+ //System.out.println(entry);
+ if ( previousKey != null ) assertTrue(entry.getKey().compareTo(previousKey) > 0);
+ resultCount++;
+ previousKey=entry.getKey();
+ }
+ System.out.println(resultCount);
+ assertTrue(resultCount>0);
+
+ // Second time with a second iterator (must give the same results)
+ int newResultCount = 0;
+ previousKey=null;
+ for ( MVDataEntry entry : reader ) {
+ //System.out.println(entry);
+ if ( previousKey != null ) assertTrue(entry.getKey().compareTo(previousKey) > 0);
+ newResultCount++;
+ previousKey=entry.getKey();
+ }
+ System.out.println(newResultCount);
+ assertTrue(newResultCount == resultCount);
+
+ }
+}
diff --git a/src/connectors/JUTests/data/io/ldap/LDAPDataWriterTest.java b/src/connectors/JUTests/data/io/ldap/LDAPDataWriterTest.java
new file mode 100644
index 0000000..01a8af0
--- /dev/null
+++ b/src/connectors/JUTests/data/io/ldap/LDAPDataWriterTest.java
@@ -0,0 +1,16 @@
+package data.io.ldap;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class LDAPDataWriterTest {
+
+ @Test
+ public void test() {
+ fail("Not yet implemented");
+ }
+
+ // TODO : test update() extensively : null, empty string, add/update/delete subcases...
+
+}