Separate InMemoryResource class for use in Acegifier web application.
This commit is contained in:
@@ -29,17 +29,16 @@ import java.io.IOException;
|
||||
public class WebXmlToAcegiSecurityConverterTests extends TestCase {
|
||||
|
||||
public void testFileConversion() throws Exception {
|
||||
WebXmlToAcegiSecurityConverter t = new WebXmlToAcegiSecurityConverter();
|
||||
WebXmlToAcegiSecurityConverter converter = new WebXmlToAcegiSecurityConverter();
|
||||
|
||||
Resource r = new ClassPathResource("test-web.xml");
|
||||
t.setInput(r.getInputStream());
|
||||
t.doConversion();
|
||||
|
||||
converter.setInput(r.getInputStream());
|
||||
converter.doConversion();
|
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
XmlBeanDefinitionReader beanReader = new XmlBeanDefinitionReader(bf);
|
||||
|
||||
int nBeans = beanReader.loadBeanDefinitions(new InMemoryResource(t.getAcegiBeansXml()));
|
||||
int nBeans = beanReader.loadBeanDefinitions(new InMemoryResource(converter.getAcegiBeansXml()));
|
||||
assertNotNull(bf.getBean("filterChainProxy"));
|
||||
|
||||
ProviderManager pm = (ProviderManager) bf.getBean("authenticationManager");
|
||||
@@ -67,24 +66,4 @@ public class WebXmlToAcegiSecurityConverterTests extends TestCase {
|
||||
FilterSecurityInterceptor fsi = sef.getFilterSecurityInterceptor();
|
||||
|
||||
}
|
||||
|
||||
private static class InMemoryResource extends AbstractResource {
|
||||
ByteArrayInputStream in;
|
||||
|
||||
public InMemoryResource(ByteArrayInputStream in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
public InMemoryResource(String source) {
|
||||
in = new ByteArrayInputStream(source.getBytes());
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return in.toString();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return in;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
<web-app>
|
||||
<display-name>login-xml</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
/WEB-INF/applicationContext-business.xml
|
||||
/WEB-INF/applicationContext-dao.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
|
||||
Reference in New Issue
Block a user