Project

General

Profile

Download (1.61 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.test.integration;
10

    
11
import org.apache.log4j.Logger;
12
import org.springframework.security.access.AccessDeniedException;
13
import org.unitils.spring.annotation.SpringApplicationContext;
14

    
15
@SpringApplicationContext("file:./target/test-classes/eu/etaxonomy/cdm/applicationContext-securityTest.xml")
16
public abstract class CdmTransactionalIntegrationTestWithSecurity extends  CdmTransactionalIntegrationTest {
17

    
18
    public static final Logger logger = Logger.getLogger(CdmTransactionalIntegrationTestWithSecurity.class);
19

    
20
    /**
21
     * Finds a nested RuntimeExceptions of the types {@link PermissionDeniedException}, {@link AccessDeniedException}
22
     * or returns null.
23
     * @param exception
24
     * @return
25
     */
26
    public static RuntimeException findSecurityRuntimeException(Throwable exception) {
27
        return SecurityExceptionUtils.findSecurityRuntimeException(exception);
28
    }
29

    
30

    
31
    /**
32
     * find in the nested <code>exception</code> the exception of type <code>clazz</code>
33
     * or returns <code>null</code> if no such exception is found.
34
     *
35
     * @param clazz
36
     * @param exception the nested <code>Throwable</code> to search in.
37
     * @return
38
     */
39
    public static <T extends Throwable> T  findThrowableOfTypeIn(Class<T> clazz, Throwable exception) {
40
        return SecurityExceptionUtils.findThrowableOfTypeIn(clazz, exception);
41
    }
42
}
(4-4/6)