Package org.apache.openejb.junit

Examples of org.apache.openejb.junit.TestSecurity


     * Prepares a method statement, configuring it for the test context
     */
    @Override
    protected Statement methodBlock(FrameworkMethod method) {
        // check if either the method/class is annotated with the TestSecurity annotation
        TestSecurity testSecurity = null;
        if (method.getMethod().isAnnotationPresent(TestSecurity.class)) {
            testSecurity = method.getMethod().getAnnotation(TestSecurity.class);
        } else if (getTestClass().getJavaClass().isAnnotationPresent(TestSecurity.class)) {
            testSecurity = getTestClass().getJavaClass().getAnnotation(TestSecurity.class);
        }

        // no security to run as, just create a normal statement
        if (testSecurity == null ||
                (testSecurity.authorized().length == 0 && testSecurity.unauthorized().length == 0)) {
            return createUnsecuredStatement(method);
        }
        // security roles specified, create separate statements for them all
        else {
            return createSecuredStatementExecutor(method, testSecurity);
View Full Code Here


     * Prepares a method statement, configuring it for the test context
     */
    @Override
    protected Statement methodBlock(FrameworkMethod method) {
        // check if either the method/class is annotated with the TestSecurity annotation
        TestSecurity testSecurity = null;
        if (method.getMethod().isAnnotationPresent(TestSecurity.class)) {
            testSecurity = method.getMethod().getAnnotation(TestSecurity.class);
        } else if (getTestClass().getJavaClass().isAnnotationPresent(TestSecurity.class)) {
            testSecurity = getTestClass().getJavaClass().getAnnotation(TestSecurity.class);
        }

        // no security to run as, just create a normal statement
        if (testSecurity == null ||
                (testSecurity.authorized().length == 0 && testSecurity.unauthorized().length == 0)) {
            return createUnsecuredStatement(method);
        }
        // security roles specified, create separate statements for them all
        else {
            return createSecuredStatementExecutor(method, testSecurity);
View Full Code Here

TOP

Related Classes of org.apache.openejb.junit.TestSecurity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.