Improved dn performance test.

This commit is contained in:
Ulrik Sandberg
2009-01-07 12:48:49 +00:00
parent a1e31becea
commit 0db66ec2d5

View File

@@ -26,12 +26,9 @@ import org.springframework.util.StopWatch;
*/
public class DnParsePerformanceITest {
/**
* Tests parsing and toString.
*/
@Test
public void testContains() {
StopWatch stopWatch = new StopWatch("Dn Parse Performance");
public void testCreateFromString() {
StopWatch stopWatch = new StopWatch("Create from String");
stopWatch.start();
for (int i = 0; i < 2000; i++) {
@@ -48,4 +45,33 @@ public class DnParsePerformanceITest {
stopWatch.stop();
System.out.println(stopWatch.prettyPrint());
}
@Test
public void testCreateFromDistinguishedName() {
DistinguishedName migpath = new DistinguishedName("OU=G,OU=I,OU=M");
DistinguishedName path1 = new DistinguishedName("cn=john.doe, OU=Users,OU=SE,OU=G,OU=I,OU=M");
DistinguishedName path2 = new DistinguishedName("cn=john.doe, OU=Users,OU=SE,ou=G,OU=i,OU=M, ou=foo");
DistinguishedName path3 = new DistinguishedName("ou=G,OU=i,OU=M, ou=foo");
DistinguishedName path4 = new DistinguishedName("ou=G,OU=i,ou=m");
DistinguishedName pathE1 = new DistinguishedName("cn=john.doe, OU=Users,OU=SE,ou=G,OU=L,OU=M, ou=foo");
DistinguishedName pathE2 = new DistinguishedName("cn=john.doe, OU=Users,OU=SE");
StopWatch stopWatch = new StopWatch("Create from DistinguishedName");
stopWatch.start();
for (int i = 0; i < 2000; i++) {
migpath = new DistinguishedName(migpath);
path1 = new DistinguishedName(path1);
path2 = new DistinguishedName(path2);
path3 = new DistinguishedName(path3);
path4 = new DistinguishedName(path4);
pathE1 = new DistinguishedName(pathE1);
pathE2 = new DistinguishedName(pathE2);
}
stopWatch.stop();
System.out.println(stopWatch.prettyPrint());
}
}