blob: dcfc60281923358f07c1c220dc55adeb83b01216 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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);
}
}
|