Luke Taylor пре 17 година
родитељ
комит
fa630a430d

+ 0 - 158
core/src/test/java/org/springframework/security/intercept/method/MockAttributes.java

@@ -1,158 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.intercept.method;
-
-import org.springframework.security.ITargetObject;
-import org.springframework.security.OtherTargetObject;
-import org.springframework.security.SecurityConfig;
-import org.springframework.security.TargetObject;
-
-import org.springframework.metadata.Attributes;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-
-/**
- * Used by the {@link MethodDefinitionAttributesTests}.
- *
- * @author Cameron Braid
- * @author Ben Alex
- */
-public class MockAttributes implements Attributes {
-    //~ Instance fields ================================================================================================
-
-    List classAttributes = Arrays.asList(new SecurityConfig[] {new SecurityConfig("MOCK_CLASS")});
-    List classMethodAttributesCountLength = Arrays.asList(new String[] {new String("MOCK_CLASS_METHOD_COUNT_LENGTH")});
-    List classMethodAttributesMakeLowerCase = Arrays.asList(new SecurityConfig[] {
-                new SecurityConfig("MOCK_CLASS_METHOD_MAKE_LOWER_CASE")
-            });
-    List classMethodAttributesMakeUpperCase = Arrays.asList(new SecurityConfig[] {
-                new SecurityConfig("MOCK_CLASS_METHOD_MAKE_UPPER_CASE")
-            });
-    List interfaceAttributes = Arrays.asList(new SecurityConfig[] {new SecurityConfig("MOCK_INTERFACE")});
-    List interfaceMethodAttributesCountLength = Arrays.asList(new SecurityConfig[] {
-                new SecurityConfig("MOCK_INTERFACE_METHOD_COUNT_LENGTH")
-            });
-    List interfaceMethodAttributesMakeLowerCase = Arrays.asList(new SecurityConfig[] {
-                new SecurityConfig("MOCK_INTERFACE_METHOD_MAKE_LOWER_CASE")
-            });
-    List interfaceMethodAttributesMakeUpperCase = Arrays.asList(new SecurityConfig[] {
-                new SecurityConfig("MOCK_INTERFACE_METHOD_MAKE_UPPER_CASE"), new SecurityConfig("RUN_AS")
-            });
-
-    //~ Methods ========================================================================================================
-
-    public Collection getAttributes(Class clazz) {
-        // Emphasise we return null for OtherTargetObject
-        if (clazz.equals(OtherTargetObject.class)) {
-            return null;
-        }
-
-        // interface
-        if (clazz.equals(ITargetObject.class)) {
-            return interfaceAttributes;
-        }
-
-        // class
-        if (clazz.equals(TargetObject.class)) {
-            return classAttributes;
-        }
-
-        return null;
-    }
-
-    public Collection getAttributes(Method method) {
-        // interface
-        if (method.getDeclaringClass().equals(ITargetObject.class)) {
-            if (method.getName().equals("countLength")) {
-                return interfaceMethodAttributesCountLength;
-            }
-
-            if (method.getName().equals("makeLowerCase")) {
-                return interfaceMethodAttributesMakeLowerCase;
-            }
-
-            if (method.getName().equals("makeUpperCase")) {
-                return interfaceMethodAttributesMakeUpperCase;
-            }
-
-            if (method.getName().equals("publicMakeLowerCase")) {
-                throw new UnsupportedOperationException("mock support not implemented");
-            }
-        }
-
-        // class
-        if (method.getDeclaringClass().equals(TargetObject.class)) {
-            if (method.getName().equals("countLength")) {
-                return classMethodAttributesCountLength;
-            }
-
-            if (method.getName().equals("makeLowerCase")) {
-                return classMethodAttributesMakeLowerCase;
-            }
-
-            if (method.getName().equals("makeUpperCase")) {
-                return classMethodAttributesMakeUpperCase;
-            }
-
-            if (method.getName().equals("publicMakeLowerCase")) {
-                throw new UnsupportedOperationException("mock support not implemented");
-            }
-        }
-
-        // other target object
-        if (method.getDeclaringClass().equals(OtherTargetObject.class)) {
-            if (method.getName().equals("countLength")) {
-                return classMethodAttributesCountLength;
-            }
-
-            if (method.getName().equals("makeLowerCase")) {
-                return classMethodAttributesMakeLowerCase;
-            }
-
-            if (method.getName().equals("makeUpperCase")) {
-                return null; // NB
-            }
-
-            if (method.getName().equals("publicMakeLowerCase")) {
-                throw new UnsupportedOperationException("mock support not implemented");
-            }
-        }
-
-        return null;
-    }
-
-    public Collection getAttributes(Class arg0, Class arg1) {
-        throw new UnsupportedOperationException("mock method not implemented");
-    }
-
-    public Collection getAttributes(Field arg0, Class arg1) {
-        throw new UnsupportedOperationException("mock method not implemented");
-    }
-
-    public Collection getAttributes(Field arg0) {
-        throw new UnsupportedOperationException("mock method not implemented");
-    }
-
-    public Collection getAttributes(Method arg0, Class arg1) {
-        throw new UnsupportedOperationException("mock method not implemented");
-    }
-}

+ 4 - 4
core/src/test/resources/log4j.properties

@@ -2,13 +2,13 @@
 #
 # $Id$
 
-log4j.rootCategory=INFO, stdout
+log4j.rootLogger=INFO, stdout
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%d %p %c{1} - %m%n
 
-log4j.category.org.springframework.security=DEBUG
-log4j.category.org.springframework.ldap=DEBUG
+log4j.logger.org.springframework.security=DEBUG,stdout
+log4j.logger.org.springframework.ldap=DEBUG
 
-log4j.category.org.apache.directory.shared.asn1=INFO
+log4j.logger.org.apache.directory=ERROR,stdout

+ 0 - 55
core/src/test/resources/org/springframework/security/intercept/method/applicationContext.xml

@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<!--
- * Copyright 2004 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
--->
-
-<beans>
-
-	<bean id="authentication" class="org.springframework.security.MockAuthenticationManager"/>
-	<bean id="accessDecision" class="org.springframework.security.MockAccessDecisionManager"/>
-	<bean id="runAs" class="org.springframework.security.MockRunAsManager"/>
-	<bean id="attributes" class="org.springframework.security.intercept.method.MockAttributes"/>
-
-	<bean id="objectDefinitionSource" class="org.springframework.security.intercept.method.MethodDefinitionAttributes">
-		<property name="attributes"><ref local="attributes"/></property>
-	</bean>
-
-	<bean id="securityInterceptor" class="org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor">
-		<property name="authenticationManager"><ref local="authentication"/></property>
-		<property name="accessDecisionManager"><ref local="accessDecision"/></property>
-		<property name="runAsManager"><ref local="runAs"/></property>
-		<property name="objectDefinitionSource">
-			<ref local="objectDefinitionSource"/>
-		</property>
-	</bean>
-
-	<bean id="realTarget" class="org.springframework.security.TargetObject"/>
-
-    <bean id="target" class="org.springframework.aop.framework.ProxyFactoryBean">
-      <property name="proxyInterfaces"><value>org.springframework.security.ITargetObject</value></property>
-      <property name="interceptorNames">
-         <list>
-            <idref local="securityInterceptor"/>
-            <idref local="realTarget"/>
-         </list>
-      </property>
-    </bean>
-
-   <bean id="secureObjectLoggerListener" class="org.springframework.security.event.authorization.LoggerListener"/>
-
-</beans>