Repository: ambari Updated Branches: refs/heads/trunk a2086b1fc -> 3782678a3
AMBARI-6723 - Views: Support clean install scenario - fix intermittent test failure. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3782678a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3782678a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3782678a Branch: refs/heads/trunk Commit: 3782678a3ad800de3be07dda99183be77ab76192 Parents: a2086b1 Author: tbeerbower <[email protected]> Authored: Mon Aug 11 15:47:00 2014 -0400 Committer: tbeerbower <[email protected]> Committed: Mon Aug 11 15:47:18 2014 -0400 ---------------------------------------------------------------------- .../authorization/AuthorizationHelperTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3782678a/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 7fecffd..6858d8d 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 @@ -21,7 +21,8 @@ import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; +import java.util.HashSet; +import java.util.Set; import org.apache.ambari.server.orm.entities.PermissionEntity; import org.apache.ambari.server.orm.entities.PrincipalEntity; @@ -88,9 +89,14 @@ public class AuthorizationHelperTest { Collection<GrantedAuthority> authorities = new AuthorizationHelper().convertPrivilegesToAuthorities(privilegeEntities); assertEquals("Wrong number of authorities", 2, authorities.size()); - Iterator<GrantedAuthority> iterator = authorities.iterator(); - assertEquals("Wrong authority name", "CLUSTER.READ@1", iterator.next().getAuthority()); - assertEquals("Wrong authority name", "CLUSTER.OPERATE@1", iterator.next().getAuthority()); + + Set<String> authorityNames = new HashSet<String>(); + + for (GrantedAuthority authority : authorities) { + authorityNames.add(authority.getAuthority()); + } + Assert.assertTrue(authorityNames.contains("CLUSTER.READ@1")); + Assert.assertTrue(authorityNames.contains("CLUSTER.OPERATE@1")); } @Test
