Use "'" for XML attributes in in-memory test contexts for readability.
This commit is contained in:
parent
7d88ee8c48
commit
1b8f13aa4c
|
@ -9,11 +9,11 @@ import org.springframework.core.io.Resource;
|
|||
*/
|
||||
public class InMemoryXmlApplicationContext extends AbstractXmlApplicationContext {
|
||||
private static final String BEANS_OPENING =
|
||||
"<b:beans xmlns=\"http://www.springframework.org/schema/security\"\n" +
|
||||
" xmlns:b=\"http://www.springframework.org/schema/beans\"\n" +
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
|
||||
" xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd\n" +
|
||||
"http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd\">\n";
|
||||
"<b:beans xmlns='http://www.springframework.org/schema/security'\n" +
|
||||
" xmlns:b='http://www.springframework.org/schema/beans'\n" +
|
||||
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" +
|
||||
" xsi:schemaLocation='http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd\n" +
|
||||
"http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd'>\n";
|
||||
private static final String BEANS_CLOSE = "</b:beans>\n";
|
||||
|
||||
Resource inMemoryXml;
|
||||
|
@ -31,8 +31,4 @@ public class InMemoryXmlApplicationContext extends AbstractXmlApplicationContext
|
|||
protected Resource[] getConfigResources() {
|
||||
return new Resource[] {inMemoryXml};
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new InMemoryXmlApplicationContext("<ldap-server />");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.springframework.security.config;
|
|||
import org.springframework.security.util.InMemoryXmlApplicationContext;
|
||||
import org.springframework.security.ldap.SpringSecurityContextSource;
|
||||
|
||||
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -38,8 +37,8 @@ public class LdapServerBeanDefinitionParserTests {
|
|||
@Test
|
||||
public void useOfUrlAttributeCreatesCorrectContextSource() {
|
||||
// Create second "server" with a url pointing at embedded one
|
||||
appCtx = new InMemoryXmlApplicationContext("<ldap-server port=\"33388\"/>" +
|
||||
"<ldap-server id=\"blah\" url=\"ldap://127.0.0.1:33388/dc=springframework,dc=org\" />");
|
||||
appCtx = new InMemoryXmlApplicationContext("<ldap-server port='33388'/>" +
|
||||
"<ldap-server id='blah' url='ldap://127.0.0.1:33388/dc=springframework,dc=org' />");
|
||||
|
||||
// Check the default context source is still there.
|
||||
appCtx.getBean(BeanIds.CONTEXT_SOURCE);
|
||||
|
@ -54,7 +53,7 @@ public class LdapServerBeanDefinitionParserTests {
|
|||
@Test
|
||||
public void loadingSpecificLdifFileIsSuccessful() {
|
||||
appCtx = new InMemoryXmlApplicationContext(
|
||||
"<ldap-server ldif=\"classpath*:test-server2.xldif\" root=\"dc=monkeymachine,dc=co,dc=uk\" />");
|
||||
"<ldap-server ldif='classpath*:test-server2.xldif' root='dc=monkeymachine,dc=co,dc=uk' />");
|
||||
SpringSecurityContextSource contextSource = (SpringSecurityContextSource) appCtx.getBean(BeanIds.CONTEXT_SOURCE);
|
||||
|
||||
LdapTemplate template = new LdapTemplate(contextSource);
|
||||
|
|
Loading…
Reference in New Issue