fix tests by setting the SystemSecurityContext to prevent NPE in tests

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-02-25 09:42:38 +01:00
committed by Nonnenmacher Fabian
parent 2be4922615
commit 4ca1bdf9ef
3 changed files with 21 additions and 3 deletions

View File

@@ -38,8 +38,18 @@ public class SystemSecurityContext {
private static final Logger logger = LoggerFactory.getLogger(SystemSecurityContext.class);
private final TenantAware tenantAware;
/**
* Autowired constructor.
*
* @param tenantAware
* the tenant aware bean to retrieve the current tenant
*/
@Autowired
private TenantAware tenantAware;
public SystemSecurityContext(final TenantAware tenantAware) {
this.tenantAware = tenantAware;
}
public <T> T runAsSystem(final Callable<T> callable) {
final SecurityContext oldContext = SecurityContextHolder.getContext();