diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2014-09-20 09:17:18 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2015-04-14 07:44:29 +0200 |
commit | d6f22a2af48f83d63b5381118d2029797458194e (patch) | |
tree | cb6bef9a98335a7af2aee40b0752d14fcee0916e /src/connectors/JUTests/data/io/ldap | |
parent | 774194091e9bcee08e48fcdf4127f9afd9d6d644 (diff) | |
download | sssync-d6f22a2af48f83d63b5381118d2029797458194e.tar.gz sssync-d6f22a2af48f83d63b5381118d2029797458194e.tar.bz2 sssync-d6f22a2af48f83d63b5381118d2029797458194e.zip |
Early development stages (before SCM) : WIP_1
Early development stages (before SCM) : WIP_2
Early development stages (before SCM) : WIP_3
Early development stages (before SCM) : WIP_4
Early development stages (before SCM) : WIP_6
Early development stages (before SCM) : WIP_7
Early development stages (before SCM) : WIP_8
Adds documentation folder as an Eclipse project.
Adds README for github.
Decent source tree by tuning Eclise project's location
One forgetten file while movign everything :)
Adding Copyright, licencing (GPL v3), correcting README
Diffstat (limited to 'src/connectors/JUTests/data/io/ldap')
-rw-r--r-- | src/connectors/JUTests/data/io/ldap/LDAPDataReaderTest.java | 94 | ||||
-rw-r--r-- | src/connectors/JUTests/data/io/ldap/LDAPDataWriterTest.java | 16 |
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... + +} |