SEC-756: Refactored GlobalMethodSecurityDefinitionParser and added check for duplicate registration.

This commit is contained in:
Luke Taylor
2008-04-22 18:25:35 +00:00
parent eec62e9760
commit 083644f2fe
2 changed files with 117 additions and 74 deletions

View File

@@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.AccessDeniedException;
@@ -79,6 +80,14 @@ public class GlobalMethodSecurityBeanDefinitionParserTests {
assertEquals("Hello from the post processor!", service.getPostProcessorWasHere());
}
@Test(expected=BeanDefinitionParsingException.class)
public void duplicateElementCausesError() {
setContext(
"<global-method-security />" +
"<global-method-security />"
);
}
private void setContext(String context) {
appContext = new InMemoryXmlApplicationContext(context);
}