You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2016/06/23 14:35:33 UTC
ambari git commit: AMBARI-17381. AuthorizationHelperTest.testAuthName
may fail due to residual SecurityContext from previously executed test cases.
(rlevas)
Repository: ambari
Updated Branches:
refs/heads/trunk bfc904b20 -> 80abd6ca6
AMBARI-17381. AuthorizationHelperTest.testAuthName may fail due to residual SecurityContext from previously executed test cases. (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/80abd6ca
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/80abd6ca
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/80abd6ca
Branch: refs/heads/trunk
Commit: 80abd6ca68977035d40f4dea942423223beecb9d
Parents: bfc904b
Author: Robert Levas <rl...@hortonworks.com>
Authored: Thu Jun 23 10:35:20 2016 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Thu Jun 23 10:35:20 2016 -0400
----------------------------------------------------------------------
.../authorization/AuthorizationHelperTest.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/80abd6ca/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java
index 8409a6b..47211ef 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java
@@ -35,7 +35,9 @@ import org.easymock.EasyMockRule;
import org.easymock.EasyMockSupport;
import org.easymock.Mock;
import org.easymock.MockType;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -73,6 +75,17 @@ public class AuthorizationHelperTest extends EasyMockSupport {
@Mock(type = MockType.NICE)
private ServletRequestAttributes servletRequestAttributes;
+ @Before
+ public void setup() {
+ // Ensure the security context has been clean up
+ SecurityContextHolder.getContext().setAuthentication(null);
+ }
+
+ @After
+ public void cleanup() {
+ // Clean up the security context for the next test
+ SecurityContextHolder.getContext().setAuthentication(null);
+ }
@Test
public void testConvertPrivilegesToAuthorities() throws Exception {