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.logging.log4j.LogManager;
|
12
|
import org.apache.logging.log4j.Logger;
|
13
|
import org.springframework.security.access.AccessDeniedException;
|
14
|
import org.unitils.spring.annotation.SpringApplicationContext;
|
15
|
|
16
|
@SpringApplicationContext("file:./target/test-classes/eu/etaxonomy/cdm/applicationContext-securityTest.xml")
|
17
|
public abstract class CdmTransactionalIntegrationTestWithSecurity extends CdmTransactionalIntegrationTest {
|
18
|
|
19
|
public static final Logger logger = LogManager.getLogger();
|
20
|
|
21
|
/**
|
22
|
* Finds a nested RuntimeExceptions of the types {@link PermissionDeniedException}, {@link AccessDeniedException}
|
23
|
* or returns null.
|
24
|
*/
|
25
|
public static RuntimeException findSecurityRuntimeException(Throwable exception) {
|
26
|
return SecurityExceptionUtils.findSecurityRuntimeException(exception);
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* find in the nested <code>exception</code> the exception of type <code>clazz</code>
|
31
|
* or returns <code>null</code> if no such exception is found.
|
32
|
*
|
33
|
* @param clazz
|
34
|
* @param exception the nested <code>Throwable</code> to search in.
|
35
|
* @return
|
36
|
*/
|
37
|
public static <T extends Throwable> T findThrowableOfTypeIn(Class<T> clazz, Throwable exception) {
|
38
|
return SecurityExceptionUtils.findThrowableOfTypeIn(clazz, exception);
|
39
|
}
|
40
|
}
|