From 2b5957a45c98860cb76f468c817de47929456a19 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Tue, 13 Dec 2011 22:17:07 -0500 Subject: [PATCH] avoiding deprecation warnings in test code --- .../integration/security/SecurityTestUtils.java | 6 +++--- .../security/channel/ChannelSecurityInterceptorTests.java | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java b/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java index 04d9d22af4..b7bfd4fb78 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.springframework.integration.security; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.GrantedAuthorityImpl; +import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextImpl; import org.springframework.util.CollectionUtils; @@ -36,7 +36,7 @@ public class SecurityTestUtils { if (roles != null && roles.length > 0) { GrantedAuthority[] authorities = new GrantedAuthority[roles.length]; for (int i = 0; i < roles.length; i++) { - authorities[i] = new GrantedAuthorityImpl(roles[i]); + authorities[i] = new SimpleGrantedAuthority(roles[i]); } authToken = new UsernamePasswordAuthenticationToken(username, password, CollectionUtils.arrayToList(authorities)); } diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/channel/ChannelSecurityInterceptorTests.java b/spring-integration-security/src/test/java/org/springframework/integration/security/channel/ChannelSecurityInterceptorTests.java index 31f4665911..4c5a9e2600 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/channel/ChannelSecurityInterceptorTests.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/channel/ChannelSecurityInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,9 +82,8 @@ public class ChannelSecurityInterceptorTests { ChannelSecurityMetadataSource securityMetadataSource = new ChannelSecurityMetadataSource(); securityMetadataSource.addPatternMapping(Pattern.compile("secured.*"), new DefaultChannelAccessPolicy(role, null)); ChannelSecurityInterceptor interceptor = new ChannelSecurityInterceptor(securityMetadataSource); - AffirmativeBased accessDecisionManager = new AffirmativeBased(); - - accessDecisionManager.setDecisionVoters(Collections.singletonList((AccessDecisionVoter)new RoleVoter())); + @SuppressWarnings("rawtypes") + AffirmativeBased accessDecisionManager = new AffirmativeBased(Collections.singletonList(new RoleVoter())); accessDecisionManager.afterPropertiesSet(); interceptor.setAccessDecisionManager(accessDecisionManager); interceptor.setAuthenticationManager(new MockAuthenticationManager(true));