Minor changes to increase coverage of methods
This commit is contained in:
parent
0d6b3ab9f3
commit
016ac8016c
|
@ -20,6 +20,7 @@ import javax.naming.directory.DirContext;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
import org.acegisecurity.BadCredentialsException;
|
import org.acegisecurity.BadCredentialsException;
|
||||||
|
import org.acegisecurity.AcegiMessageSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link org.acegisecurity.ldap.DefaultInitialDirContextFactory}.
|
* Tests {@link org.acegisecurity.ldap.DefaultInitialDirContextFactory}.
|
||||||
|
@ -32,6 +33,7 @@ public class DefaultInitialDirContextFactoryTests extends AbstractLdapServerTest
|
||||||
|
|
||||||
public void onSetUp() {
|
public void onSetUp() {
|
||||||
idf = getInitialCtxFactory();
|
idf = getInitialCtxFactory();
|
||||||
|
idf.setMessageSource(new AcegiMessageSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void testNonLdapUrlIsRejected() throws Exception {
|
// public void testNonLdapUrlIsRejected() throws Exception {
|
||||||
|
@ -50,7 +52,6 @@ public class DefaultInitialDirContextFactoryTests extends AbstractLdapServerTest
|
||||||
public void testServiceLocationUrlIsSupported() {
|
public void testServiceLocationUrlIsSupported() {
|
||||||
idf = new DefaultInitialDirContextFactory("ldap:///dc=acegisecurity,dc=org");
|
idf = new DefaultInitialDirContextFactory("ldap:///dc=acegisecurity,dc=org");
|
||||||
assertEquals("dc=acegisecurity,dc=org", idf.getRootDn());
|
assertEquals("dc=acegisecurity,dc=org", idf.getRootDn());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSecureLdapUrlIsSupported() {
|
public void testSecureLdapUrlIsSupported() {
|
||||||
|
@ -65,6 +66,7 @@ public class DefaultInitialDirContextFactoryTests extends AbstractLdapServerTest
|
||||||
Hashtable env = new Hashtable();
|
Hashtable env = new Hashtable();
|
||||||
env.put("com.sun.jndi.ldap.connect.timeout", "200");
|
env.put("com.sun.jndi.ldap.connect.timeout", "200");
|
||||||
idf.setExtraEnvVars(env);
|
idf.setExtraEnvVars(env);
|
||||||
|
idf.setUseConnectionPool(false); // coverage purposes only
|
||||||
|
|
||||||
try {
|
try {
|
||||||
idf.newInitialDirContext();
|
idf.newInitialDirContext();
|
||||||
|
@ -159,7 +161,7 @@ public class DefaultInitialDirContextFactoryTests extends AbstractLdapServerTest
|
||||||
assertEquals("extravarvalue", env.get("extravar"));
|
assertEquals("extravarvalue", env.get("extravar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBaseDnIsParsedFromCorrectlyFromUrl() throws Exception {
|
public void testBaseDnIsParsedFromCorrectlyFromUrl() {
|
||||||
idf = new DefaultInitialDirContextFactory("ldap://acegisecurity.org/dc=acegisecurity,dc=org");
|
idf = new DefaultInitialDirContextFactory("ldap://acegisecurity.org/dc=acegisecurity,dc=org");
|
||||||
assertEquals("dc=acegisecurity,dc=org", idf.getRootDn());
|
assertEquals("dc=acegisecurity,dc=org", idf.getRootDn());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue